Expand description
contains logging levels and filters Defines the levels of verbosity available for logging, as well as LevelFilter.
Logging Levels
Defined in Level
. Consists of 5 levels in total:
LevelFilters
Similarly, LevelFilter
correspond to [Level'], with the addition of [
LevelFilter::Off`].
Logging levels will be skipped if a level is lower than current LevelFilter
,
i.e. Level::Debug
is skipped when LevelFilter is set to Info
, but Level::Info
logs will not be skipped.
Compile time filter specification
Level filter can be set at runtime, via Cargo features. This level is configured separately for release and debug builds through the following feature flags:
max_level_off
max_level_error
max_level_warn
max_level_info
max_level_debug
max_level_trace
release_max_level_off
release_max_level_error
release_max_level_warn
release_max_level_info
release_max_level_debug
release_max_level_trace
These features control the value of the const MAX_LOG_LEVEL
constant. The
log macros check this value before logging. By default, no levels are disabled.
For example, a crate can disable trace level logs in debug builds and trace, debug, and info level logs in release builds with the following configuration:
[dependencies]
quicklog = { version = "0.1", features = ["max_level_debug", "release_max_level_warn"] }
Enums
Constants
- Statically configured maximum level, this is configured from Cargo.toml, by passing in the relevant feature flags By default, the level would be configured to LevelFilter::Trace