Skip to content

Commit

Permalink
fix conditional compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
Adjective-Object committed Dec 11, 2024
1 parent 5e4038a commit edb9fc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions crates/logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Logger> Logger for &T {
fn log(&self, message: impl Display) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
"."
],
"packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb"
}
}

0 comments on commit edb9fc8

Please sign in to comment.