1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#[cfg(feature = "logging")]
macro_rules! log {
    ( $fmt:expr ) => {
        println!($fmt);
    };
    ( $fmt:expr, $($x:tt)* ) => {
        println!($fmt, $($x)*);
    }
}

#[cfg(not(feature = "logging"))]
macro_rules! log {
    ( $fmt:expr ) => {};
    ( $fmt:expr, $($x:tt)* ) => {
        if false { let _ = format!($fmt, $($x)*); }
    };
}