ckb_logger

Macro log_enabled_target

Source
macro_rules! log_enabled_target {
    ($target:expr, $level:expr) => { ... };
}
Expand description

Determines if a message logged at the specified level and with the specified target will be logged.

This can be used to avoid expensive computation of log message arguments if the message would be ignored anyway.

See also log_enabled! the version that checks with the default target.

ยงExamples

use ckb_logger::Level::Debug;
use ckb_logger::{debug_target, log_enabled_target};

if log_enabled_target!("Global", Debug) {
    let data = expensive_call();
    debug_target!("Global", "expensive debug data: {} {}", data.x, data.y);
}