log::debug! [-]  [+] [src]

macro_rules! debug {
    ($($arg:tt)*) => (if cfg!(not(ndebug)) { log!(::log::DEBUG, $($arg)*) })
}

A convenience macro for logging at the debug log level. This macro can also be omitted at compile time by passing --cfg ndebug to the compiler. If this option is not passed, then debug statements will be compiled.

Example

#[macro_use] extern crate log;

fn main() {
    debug!("x = {x}, y = {y}", x=10i, y=20i);
}

Assumes the binary is main:

$ RUST_LOG=debug ./main
DEBUG:main: x = 10, y = 20