bronzeflow_utils/
log.rs

1#[macro_export]
2macro_rules! info {
3    ($($arg:tt)*) => {{
4        println!("info: {}", format!($($arg)*));
5    }};
6}
7
8#[macro_export]
9macro_rules! warn {
10    ($($arg:tt)*) => {{
11        println!("warn: {}", format!($($arg)*));
12    }};
13}
14
15#[macro_export]
16macro_rules! error {
17    ($($arg:tt)*) => {{
18        eprintln!("warn: {}", format!($($arg)*));
19    }};
20}
21
22#[macro_export]
23macro_rules! debug {
24    ($($arg:tt)*) => {{
25        println!("debug: {}", format!($($arg)*));
26    }};
27}
28
29#[cfg(test)]
30mod tests {
31
32    #[test]
33    fn test_log() {
34        info!("hello, this is {} log", "info");
35        warn!("hello, this is {} log", "warn");
36        error!("hello, this is {} log", "error");
37        error!("hello, this is {} log", "debug");
38    }
39}