Macro ckb_logger::log_enabled_target[][src]

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

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);
}