mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 14:41:32 +00:00
Improved debug! macro with timing
This commit is contained in:
@ -1,8 +1,14 @@
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
macro_rules! debug {
|
macro_rules! debug {
|
||||||
($fmt:expr) => (println!(concat!("wasmer-runtime(:{})::", $fmt), line!()));
|
($fmt:expr) => (println!(concat!("[{}] wasmer-runtime(:{}) ", $fmt), {
|
||||||
($fmt:expr, $($arg:tt)*) => (println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*));
|
let time = ::std::time::SystemTime::now().duration_since(::std::time::UNIX_EPOCH).expect("Can't get time");
|
||||||
|
format!("{}.{:03}", time.as_secs(), time.subsec_millis())
|
||||||
|
}, line!()));
|
||||||
|
($fmt:expr, $($arg:tt)*) => (println!(concat!("[{}] wasmer-runtime(:{}) ", $fmt, "\n"), {
|
||||||
|
let time = ::std::time::SystemTime::now().duration_since(::std::time::UNIX_EPOCH).expect("Can't get time");
|
||||||
|
format!("{}.{:03}", time.as_secs(), time.subsec_millis())
|
||||||
|
}, line!(), $($arg)*));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
Reference in New Issue
Block a user