diff --git a/crates/logger/src/lib.rs b/crates/logger/src/lib.rs index 724acc3..1fdc54a 100644 --- a/crates/logger/src/lib.rs +++ b/crates/logger/src/lib.rs @@ -13,16 +13,20 @@ pub trait Logger: Clone { } #[macro_export] -#[cfg(debug_assertions)] +macro_rules! cfg { + ($($cfg:tt)*) => { + /* compiler built-in */ + }; +} + +#[macro_export] macro_rules! debug_logf { ($logger:expr, $fmt:expr $(, $arg:expr)*) => { + if cfg!(debug_assertions) { $logger.log(format!($fmt $(, $arg)*)); + } }; } -#[cfg(not(debug_assertions))] -macro_rules! debug_logf { - ($logger:expr, $fmt:expr $(, $arg:expr)*) => {}; -} impl Logger for &T { fn log(&self, message: impl Display) { diff --git a/package.json b/package.json index 87182e8..6bf7f30 100644 --- a/package.json +++ b/package.json @@ -53,4 +53,4 @@ "." ], "packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb" -} +} \ No newline at end of file