Consolidate to single debug macro, activate using feature

This commit is contained in:
Brandon Fish
2019-01-28 20:06:57 -06:00
parent 7cf6fee998
commit 948e685dd6
4 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1 @@
macro_rules! debug {
($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt), line!()) });
($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*) });
}

View File

@ -1,6 +1,15 @@
#[macro_export]
#[cfg(feature = "debug")]
macro_rules! debug {
($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt), line!()) });
($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*) });
($fmt:expr) => (println!(concat!("wasmer-runtime(:{})::", $fmt), line!()));
($fmt:expr, $($arg:tt)*) => (println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*));
}
#[macro_export]
#[cfg(not(feature = "debug"))]
macro_rules! debug {
($fmt:expr) => {};
($fmt:expr, $($arg:tt)*) => {};
}
#[macro_export]

View File

@ -1,8 +1,7 @@
#[macro_use]
extern crate wasmer_runtime_core;
// extern crate wasmer_emscripten;
#[macro_use]
mod macros;
#[macro_use]
pub mod update;
pub mod webassembly;

View File

@ -1,5 +0,0 @@
#[macro_export]
macro_rules! debug {
($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("Wasmer::", $fmt)) });
($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("Wasmer::", $fmt, "\n"), $($arg)*) });
}