Expand description
Opt-in client-side tracing for the decdn CLI.
The CLI is a terminal UI: by default it installs no tracing subscriber, so
its output is only the command’s own stdout result and the stderr progress
bar. That keeps the common case clean, but it also means every
tracing::debug!/info!/warn! in decdn-client, decdn-incentive, and
iroh goes to a no-op collector — a stalled decdn fetch is silent on the
side that is actually failing.
init turns logging on only when the operator asks for it, through
-v/-vv/-vvv, --log-level, or the RUST_LOG environment variable.
RUST_LOG wins (the same precedence the daemon uses), then --log-level,
then the -v count (requested_level). With none of them set the CLI
installs no subscriber and stays silent.
§Progress-bar coexistence
decdn fetch draws an indicatif progress bar to stderr, and a plain
stderr subscriber would shred it. When init installs a subscriber it
also creates one process-global indicatif::MultiProgress: log lines are
written through indicatif::MultiProgress::suspend, and the fetch bar is
registered with the same MultiProgress (see attach_progress_bar), so
the two share stderr without corrupting each other. When no subscriber is
installed the bar draws straight to stderr as it always has.
Functions§
- attach_
progress_ bar - Register a freshly built progress bar with the shared
indicatif::MultiProgresswhen a subscriber is installed, so log lines and the bar coexist on stderr. - init
- Install the CLI tracing subscriber when the operator opts in.
- progress_
container - The
indicatif::MultiProgressa multi-bar command (bundle pull) draws its bars into: the process-global one when a subscriber is installed — so its bars share stderr with log lines throughindicatif::MultiProgress::suspend— or a fresh standalone container on the default silent path, where there are no log lines to coordinate with. Either way the bars stack coherently, and a non-terminal stderr auto-hides them. - requested_
level - The level the command line asks for: an explicit
--log-levelwins over the-vcount, and a zero count with no--log-levelasks for nothing.