up_rs/utils/
log.rs

1//! Utilities to help with logging.
2
3/**
4Equivalent of `::log::log!()` for the tracing crate.
5
6Refs: <https://github.com/tokio-rs/tracing/issues/2730#issuecomment-1943022805>
7*/
8#[macro_export]
9macro_rules! log {
10    ($lvl:ident, $($arg:tt)+) => {
11        match $lvl {
12            ::tracing::Level::TRACE => ::tracing::trace!($($arg)+),
13            ::tracing::Level::DEBUG => ::tracing::debug!($($arg)+),
14            ::tracing::Level::INFO => ::tracing::info!($($arg)+),
15            ::tracing::Level::WARN => ::tracing::warn!($($arg)+),
16            ::tracing::Level::ERROR => ::tracing::error!($($arg)+),
17        }
18    };
19}