Skip to main content

runar_keys/
macros.rs

1// Lightweight re-export shims for logging macros to avoid macro-crate cycles.
2// These forward to runar_common::logging::Logger methods with level checks.
3
4#[macro_export]
5macro_rules! log_debug {
6    ($logger:expr, $($arg:tt)*) => {{
7        if ::log::log_enabled!(::log::Level::Debug) {
8            ($logger).debug_args(format_args!($($arg)*));
9        }
10    }}
11}
12
13#[macro_export]
14macro_rules! log_info {
15    ($logger:expr, $($arg:tt)*) => {{
16        if ::log::log_enabled!(::log::Level::Info) {
17            ($logger).info_args(format_args!($($arg)*));
18        }
19    }}
20}
21
22#[macro_export]
23macro_rules! log_warn {
24    ($logger:expr, $($arg:tt)*) => {{
25        if ::log::log_enabled!(::log::Level::Warn) {
26            ($logger).warn_args(format_args!($($arg)*));
27        }
28    }}
29}
30
31#[macro_export]
32macro_rules! log_error {
33    ($logger:expr, $($arg:tt)*) => {{
34        if ::log::log_enabled!(::log::Level::Error) {
35            ($logger).error_args(format_args!($($arg)*));
36        }
37    }}
38}