Expand description
Logging facade that compiles to no-ops when the logging feature is disabled.
When the logging feature is enabled, this module re-exports the
tracing macros (info!, warn!, debug!, error!, trace!).
When disabled, all macros expand to () — zero binary size overhead,
zero runtime cost. Argument expressions are not evaluated, so
info!("{}", expensive_call()) costs nothing in release builds.
§Unused variables with --no-default-features
Variables that exist only for logging (e.g. let addr_hex = hex::encode(...))
become unused when macros are compiled out. The crate-level attribute
#![cfg_attr(not(feature = "logging"), allow(unused_variables, unused_assignments))]
in lib.rs (and the binary entry points) suppresses these expected warnings.
Macros§
- debug
- Constructs an event at the debug level.
- enabled
- Checks whether a span or event is enabled based on the provided metadata.
- error
- Constructs an event at the error level.
- info
- Constructs an event at the info level.
- trace
- Constructs an event at the trace level.
- warn
- Constructs an event at the warn level.
Structs§
- Level
- Describes the level of verbosity of a span or event.