Expand description
Lazy logging with bitwise level control.
Expensive log messages are supplied as closures and are only evaluated when the requested level is enabled.
use log_lazy::{levels, LogLazy};
let log = LogLazy::with_level(levels::ERROR);
let mut evaluated = false;
log.debug(|| {
evaluated = true;
"debug details"
});
assert!(!evaluated);Modules§
- levels
- Standard bitwise log level constants.
- postprocessors
- Built-in postprocessor helpers.
- preprocessors
- Built-in preprocessor helpers.
Macros§
- debug_
lazy - Lazily formats and emits a
debugmessage. - error_
lazy - Lazily formats and emits an
errormessage. - info_
lazy - Lazily formats and emits an
infomessage. - log_
lazy - Lazily formats and emits a message at an explicit level.
Structs§
- Level
- One standard output log level.
- LogArg
- One log argument that can be evaluated lazily.
- LogLazy
- Logger instance with a mutable bitmask and lazy message evaluation.
- LogLazy
Options - Options for constructing a logger with the extensible API.
- Postprocessor
Options - Options passed to a postprocessor.
- Preprocessor
Options - Options passed to a preprocessor.
Enums§
- Level
Spec - Level input accepted by the logger.
- Owned
Level Spec - Owned level input accepted by
LogLazyOptions.
Constants§
- STANDARD_
LEVELS - Standard levels in the order returned by
LogLazy::get_enabled_levels.
Type Aliases§
- Level
Mask - Bitmask used to represent enabled log levels.
- LogSink
- Function used to emit an already evaluated log message.
- Postprocessor
- Function used to transform a compiled message before output.
- Preprocessor
- Function used to transform log arguments before message compilation.