Skip to main content

Module logging

Module logging 

Source
Expand description

Tracing and logging initialisation.

Why: All binaries need consistent stderr-bound tracing setup; centralising it prevents duplicated setup across entry points. What: init_tracing, init_tracing_for_test, DEFAULT_LOG_LEVEL. Test: logging::tests::*. Tracing and logging initialisation for tcode.

Why: All tcode binaries and the library’s test harness need consistent tracing initialisation that writes to stderr (never stdout — stdout is the API transport channel). Centralising it here prevents duplicated setup and ensures the try_init pattern is used everywhere so test binaries remain idempotent. What: init_tracing initialises the global tracing subscriber from the RUST_LOG env var. init_tracing_for_test is a lightweight variant for test binaries that silently drops duplicate init errors. Test: init_tracing_for_test_is_idempotent calls the function twice and asserts no panic.

Constants§

DEFAULT_LOG_LEVEL
Log level used when no RUST_LOG env var is set.

Functions§

init_tracing
Initialise the global tracing subscriber.
init_tracing_for_test
Initialise the global tracing subscriber, silently ignoring duplicate inits.