From 0b5c9c0c6842074a086a282286fad7cc45806a6a Mon Sep 17 00:00:00 2001 From: WangRunji Date: Thu, 12 Jul 2018 18:55:11 +0800 Subject: [PATCH] Print log level --- src/io/riscv_io.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/io/riscv_io.rs b/src/io/riscv_io.rs index c324296..bb2e756 100644 --- a/src/io/riscv_io.rs +++ b/src/io/riscv_io.rs @@ -14,28 +14,28 @@ macro_rules! println { } macro_rules! trace { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => (print!(concat!("[trace] ", $fmt, "\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!("[trace] ", $fmt, "\n"), $($arg)*)); } macro_rules! debug { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => (print!(concat!("[debug] ", $fmt, "\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!("[debug] ", $fmt, "\n"), $($arg)*)); } macro_rules! info { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => (print!(concat!("[ info] ", $fmt, "\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!("[ info] ", $fmt, "\n"), $($arg)*)); } macro_rules! warn { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => (print!(concat!("[ warn] ", $fmt, "\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!("[ warn] ", $fmt, "\n"), $($arg)*)); } macro_rules! error { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); - ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); + ($fmt:expr) => (print!(concat!("[error] ", $fmt, "\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!("[error] ", $fmt, "\n"), $($arg)*)); } pub fn print(args: fmt::Arguments) {