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();log_guard = init_tracing( default_filter="info", writer=LogWriter.Stdout,)var option = new TracingOption{ DefaultFilter = "info", Writer = LogWriter.Stdout,};using var logGuard = Tracing.Init(option);init_tracing in Python and C# returns a guard.
Keep the guard until the end of the program.
TracingOption (Python / C#)
Section titled “TracingOption (Python / C#)”| 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.