1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// log.rs

#[macro_export]
macro_rules! debug {
    ($fmt:expr) => (
        #[cfg(debug_assertions)]
        print!(concat!(" [DEBUG] ",$fmt, "\n")));
    ($fmt:expr, $($arg:tt)*) => (
        #[cfg(debug_assertions)]
        print!(concat!(" [DEBUG] ", $fmt, "\n"), $($arg)*));
}

#[macro_export]
macro_rules! disasm_debug {
    ($fmt:expr) => (
        #[cfg(test)]
        #[cfg(debug_assertions)]
        print!(concat!(" [DEBUG] ",$fmt, "\n")));
    ($fmt:expr, $($arg:tt)*) => (
        #[cfg(test)]
        #[cfg(debug_assertions)]
        print!(concat!(" [DEBUG] ", $fmt, "\n"), $($arg)*));
}

macro_rules! error {
    ($fmt:expr) => (print!(concat!("[ERROR] ",$fmt, "\n")));
    ($fmt:expr, $($arg:tt)*) => (print!(concat!("[ERROR] ", $fmt, "\n"), $($arg)*));
}

#[allow(unused_macros)]
macro_rules! info {
    ($fmt:expr) => (print!(concat!("[INFO] ",$fmt, "\n")));
    ($fmt:expr, $($arg:tt)*) => (print!(concat!("[INFO] ", $fmt, "\n"), $($arg)*));
}