Expand description
Unified tracing initialization for gglib.
Design:
- A single layered subscriber (console + daily rotating file) is installed once via
OnceLock. - Calls to
init_tracingare idempotent — subsequent calls returnOk(()). - Log directory:
./logs/in debug builds,data_root()/logsin release. - Filter:
RUST_LOGenv var wins; otherwise"debug"if verbose, else"warn". - Console output goes through
console_println, which defaults to stderr but can be redirected viaset_console_hook— see the “Console hook” section below.
Structs§
- Console
Writer 🔒 Writetarget for the tracingfmtlayer. Buffers one formatted record and forwards it as a single line viaconsole_printlnwhen dropped —fmt::layer()creates a fresh writer per event, soDropis exactly “this record is complete.”
Statics§
- CONSOLE_
HOOK 🔒 - Route for formatted log lines and other CLI console output.
Nonemeans “print straight to stderr”. - GUARD 🔒
Functions§
- build_
env_ 🔒filter - clear_
console_ hook - Remove a previously installed hook, reverting to plain stderr.
- console_
println - Print one line through the installed console hook, or to stderr if none is installed.
- init_
tracing - Initialize the global tracing subscriber.
- resolve_
log_ 🔒dir - set_
console_ hook - Install a hook that receives each formatted log line (and other console
output routed via
console_println) instead of stderr.
Type Aliases§
- Console
Hook - A sink for formatted console lines, e.g. one backed by
MultiProgress::println.