Skip to main content

Crate log_lazy

Crate log_lazy 

Source
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 debug message.
error_lazy
Lazily formats and emits an error message.
info_lazy
Lazily formats and emits an info message.
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.
LogLazyOptions
Options for constructing a logger with the extensible API.
PostprocessorOptions
Options passed to a postprocessor.
PreprocessorOptions
Options passed to a preprocessor.

Enums§

LevelSpec
Level input accepted by the logger.
OwnedLevelSpec
Owned level input accepted by LogLazyOptions.

Constants§

STANDARD_LEVELS
Standard levels in the order returned by LogLazy::get_enabled_levels.

Type Aliases§

LevelMask
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.