|
1 |
| -/// Prints a log message with args, similar to println, when the debug feature is enabled. |
2 |
| -/// If the debug feature is disabled, arguments are not evaluated or printed. |
3 |
| -#[macro_export] |
4 |
| -#[cfg(feature = "debug")] |
5 |
| -macro_rules! debug { |
6 |
| - ($fmt:expr) => (println!(concat!("[{}] wasmer-runtime(:{}) ", $fmt), { |
7 |
| - let time = ::std::time::SystemTime::now().duration_since(::std::time::UNIX_EPOCH).expect("Can't get time"); |
8 |
| - format!("{}.{:03}", time.as_secs(), time.subsec_millis()) |
9 |
| - }, line!())); |
10 |
| - ($fmt:expr, $($arg:tt)*) => (println!(concat!("[{}] wasmer-runtime(:{}) ", $fmt, "\n"), { |
11 |
| - let time = ::std::time::SystemTime::now().duration_since(::std::time::UNIX_EPOCH).expect("Can't get time"); |
12 |
| - format!("{}.{:03}", time.as_secs(), time.subsec_millis()) |
13 |
| - }, line!(), $($arg)*)); |
14 |
| -} |
15 |
| - |
16 |
| -/// Prints a log message with args, similar to println, when the debug feature is enabled. |
17 |
| -/// If the debug feature is disabled, arguments are not evaluated or printed. |
18 |
| -#[macro_export] |
19 |
| -#[cfg(not(feature = "debug"))] |
20 |
| -macro_rules! debug { |
21 |
| - ($fmt:expr) => {}; |
22 |
| - ($fmt:expr, $($arg:tt)*) => {}; |
23 |
| -} |
24 |
| - |
25 |
| -/// Prints a log message with args, similar to println, when the trace feature is enabled. |
26 |
| -/// If the trace feature is disabled, arguments are not evaluated or printed. |
27 |
| -#[macro_export] |
28 |
| -#[cfg(feature = "trace")] |
29 |
| -macro_rules! trace { |
30 |
| - ($fmt:expr) => { |
31 |
| - debug!($fmt) |
32 |
| - }; |
33 |
| - ($fmt:expr, $($arg:tt)*) => { |
34 |
| - debug!($fmt, $($arg)*); |
35 |
| - } |
36 |
| -} |
37 |
| - |
38 |
| -/// Prints a log message with args, similar to println, when the trace feature is enabled. |
39 |
| -/// If the trace feature is disabled, arguments are not evaluated or printed. |
40 |
| -#[macro_export] |
41 |
| -#[cfg(not(feature = "trace"))] |
42 |
| -macro_rules! trace { |
43 |
| - ($fmt:expr) => {}; |
44 |
| - ($fmt:expr, $($arg:tt)*) => {}; |
45 |
| -} |
46 |
| - |
47 | 1 | /// Helper macro to create a new `Func` object using the provided function pointer.
|
48 | 2 | ///
|
49 | 3 | /// # Usage
|
|
0 commit comments