mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 14:11:32 +00:00
Update logging to use log
, add command line flag to toggle it
This commit is contained in:
@ -1,49 +1,3 @@
|
||||
/// Prints a log message with args, similar to println, when the debug feature is enabled.
|
||||
/// If the debug feature is disabled, arguments are not evaluated or printed.
|
||||
#[macro_export]
|
||||
#[cfg(feature = "debug")]
|
||||
macro_rules! debug {
|
||||
($fmt:expr) => (println!(concat!("[{}] wasmer-runtime(:{}) ", $fmt), {
|
||||
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)*));
|
||||
}
|
||||
|
||||
/// Prints a log message with args, similar to println, when the debug feature is enabled.
|
||||
/// If the debug feature is disabled, arguments are not evaluated or printed.
|
||||
#[macro_export]
|
||||
#[cfg(not(feature = "debug"))]
|
||||
macro_rules! debug {
|
||||
($fmt:expr) => {};
|
||||
($fmt:expr, $($arg:tt)*) => {};
|
||||
}
|
||||
|
||||
/// Prints a log message with args, similar to println, when the trace feature is enabled.
|
||||
/// If the trace feature is disabled, arguments are not evaluated or printed.
|
||||
#[macro_export]
|
||||
#[cfg(feature = "trace")]
|
||||
macro_rules! trace {
|
||||
($fmt:expr) => {
|
||||
debug!($fmt)
|
||||
};
|
||||
($fmt:expr, $($arg:tt)*) => {
|
||||
debug!($fmt, $($arg)*);
|
||||
}
|
||||
}
|
||||
|
||||
/// Prints a log message with args, similar to println, when the trace feature is enabled.
|
||||
/// If the trace feature is disabled, arguments are not evaluated or printed.
|
||||
#[macro_export]
|
||||
#[cfg(not(feature = "trace"))]
|
||||
macro_rules! trace {
|
||||
($fmt:expr) => {};
|
||||
($fmt:expr, $($arg:tt)*) => {};
|
||||
}
|
||||
|
||||
/// Helper macro to create a new `Func` object using the provided function pointer.
|
||||
///
|
||||
/// # Usage
|
||||
|
Reference in New Issue
Block a user