Skip to main content

init_tracing

Function init_tracing 

Source
pub fn init_tracing(cli: &Cli, toml_directive: Option<&str>)
Expand description

Install the global tracing subscriber once for this process.

Writes to stderr with an EnvFilter built from CLI verbosity and the XDG log_directive key — never from the environment. Idempotent: a second call (integration tests re-enter run_with_io) is a no-op so the first install wins for the process lifetime.

toml_directive comes from config.toml; an unparseable value falls back to DEFAULT_LOG_DIRECTIVE instead of aborting, because a typo in an optional diagnostics knob must never take the command down with it.

Does not return a WorkerGuard: the writer is stderr (no background appender thread). FINALIZE still flushes stdio via crate::shutdown::flush_stdio.