Skip to content

Logging

The library’s logs are emitted through the tracing crate. In Rust, the library has no logging initialization API; initialize it with tracing-subscriber or the like. Python and C# provide init_tracing for initializing logging.

tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
)
.init();

init_tracing in Python and C# returns a guard. Keep the guard until the end of the program.

Field Type Default Description
default_filter &'static str "info" Filter used when the RUST_LOG environment variable is not set
writer LogWriter Stdout Output destination. LogWriter::Stdout / LogWriter::Stderr

If the RUST_LOG environment variable is set, it takes precedence over default_filter.