tracing
Structured logging framework, paired with tracing-subscriber for
terminal output. Used instead of println! per CLAUDE.md's conventions
(levels: trace/debug/info/warn/error). Chosen as the ecosystem standard,
with a ready-made formatter.
main.rs's init_logging(debug: bool) installs the subscriber once,
first thing in main. debug comes from the --debug CLI flag
(extract_debug_flag), not an environment variable — CLAUDE.md prefers a
flag/config.toml over env vars for per-run settings. With --debug,
the filter is fixed to "info,trango=debug,word_analysis=debug";
otherwise RUST_LOG still works as a lower-level escape hatch, defaulting
to info.
Pitfalls
init_logging()must run before anytracing::*!calls, or events are dropped silently.- The
env-filterfeature (needed for both--debugandRUST_LOG) isn't intracing-subscriber's default features — enabled explicitly incrates/app/Cargo.toml. - Plain
RUST_LOG=debugalso enables chatty dependency logs (winitespecially) — scope it like--debugdoes, e.g.RUST_LOG=trango=debug,word_analysis=debug.