Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Process-local diagnostic subscriber for the CLI entry path.

§Binary vs library

Product modules (http, cache, docs_rs, …) only emit events/spans. Global subscriber installation happens once on the process entry path (crate::run / crate::run_with_io), not from pure library helpers.

§Agent-first sinks

  • stdout: structured command output (JSON/Markdown) — never diagnostics
  • stderr: tracing events, progress lines, human errors

File rotation (tracing-appender), OpenTelemetry/OTLP, reload::Layer admin endpoints, and tokio-console are out of scope for this one-shot CLI: there is no long-lived process, no admin surface, and no product telemetry export. Diagnostics stay on stderr for agent capture.

§Targets

Events use module paths under docsrs_cli::… (e.g. docsrs_cli::http, docsrs_cli::cache, docsrs_cli::diagnostics). Override with RUST_LOG (e.g. RUST_LOG=docsrs_cli=debug,docsrs_cli::http=trace).

§CLI vs env

-v / -vv / -q set the default directive when RUST_LOG is unset. When RUST_LOG is set, it wins over CLI verbosity (standard EnvFilter).

Functions§

init_tracing
Install the global tracing subscriber once for this process.