1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#[cfg(not(test))]
pub static mut GLOBAL_DEBUG: bool = false;
#[cfg(test)]
pub static mut GLOBAL_DEBUG: bool = true;

#[macro_export]
macro_rules! debug {
    ($($arg:tt)*) => (if unsafe { ::debug::GLOBAL_DEBUG } { eprintln!( $($arg)* ) })
}

pub unsafe fn enable() {
    GLOBAL_DEBUG = true;
}