[][src]Macro ckb_logger::log_enabled

macro_rules! log_enabled {
    ($level:expr) => { ... };
}

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

The default target is the module path of the location of the log request. See also log_enabled_target! the version that supports checking arbitrary target.

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

Examples

use ckb_logger::Level::Debug;
use ckb_logger::{debug, log_enabled};

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