2024-04-21 22:41:47 -07:00
|
|
|
/// Log event at given level in debug-mode (when debug-assertions are enabled).
|
|
|
|
/// In release mode it becomes DEBUG level, and possibly subject to elision.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! debug_event {
|
|
|
|
( $level:expr, $($x:tt)+ ) => {
|
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
tracing::event!( $level, $($x)+ );
|
|
|
|
} else {
|
|
|
|
tracing::debug!( $($x)+ );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-19 20:48:47 -07:00
|
|
|
/// Log message at the ERROR level in debug-mode (when debug-assertions are
|
|
|
|
/// enabled). In release mode it becomes DEBUG level, and possibly subject to
|
|
|
|
/// elision.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! debug_error {
|
|
|
|
( $($x:tt)+ ) => {
|
2024-04-21 22:41:47 -07:00
|
|
|
$crate::debug_event!(tracing::Level::ERROR, $($x)+ );
|
2024-04-19 20:48:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Log message at the WARN level in debug-mode (when debug-assertions are
|
|
|
|
/// enabled). In release mode it becomes DEBUG level, and possibly subject to
|
|
|
|
/// elision.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! debug_warn {
|
|
|
|
( $($x:tt)+ ) => {
|
2024-04-21 22:41:47 -07:00
|
|
|
$crate::debug_event!(tracing::Level::WARN, $($x)+ );
|
2024-04-19 20:48:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Log message at the INFO level in debug-mode (when debug-assertions are
|
|
|
|
/// enabled). In release mode it becomes DEBUG level, and possibly subject to
|
|
|
|
/// elision.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! debug_info {
|
|
|
|
( $($x:tt)+ ) => {
|
2024-04-21 22:41:47 -07:00
|
|
|
$crate::debug_event!(tracing::Level::INFO, $($x)+ );
|
2024-04-19 20:48:47 -07:00
|
|
|
}
|
|
|
|
}
|