Correct `use`

pull/189/head
Piotr Zaczkowski 2024-07-25 11:31:29 +02:00 committed by Ethan Brierley
parent 939681cd93
commit 4ea0e42bcd
1 changed files with 10 additions and 5 deletions

View File

@ -11,8 +11,13 @@ use retry_policies::RetryPolicy;
#[cfg(feature = "tracing")] #[cfg(feature = "tracing")]
type LogLevel = ::tracing::Level; type LogLevel = ::tracing::Level;
#[cfg(feature = "tracing")]
use ::tracing as LogTracing;
#[cfg(all(feature = "log", not(feature = "tracing")))] #[cfg(all(feature = "log", not(feature = "tracing")))]
type LogLevel = ::log::Level; type LogLevel = ::log::Level;
#[cfg(all(feature = "log", not(feature = "tracing")))]
use ::log as LogTracing;
#[doc(hidden)] #[doc(hidden)]
// We need this macro because tracing expects the level to be const: // We need this macro because tracing expects the level to be const:
@ -20,11 +25,11 @@ type LogLevel = ::log::Level;
macro_rules! log_retry { macro_rules! log_retry {
($level:expr, $($args:tt)*) => {{ ($level:expr, $($args:tt)*) => {{
match $level { match $level {
LogLevel::TRACE => ::tracing::trace!($($args)*), LogLevel::TRACE => LogTracing::trace!($($args)*),
LogLevel::DEBUG => ::tracing::debug!($($args)*), LogLevel::DEBUG => LogTracing::debug!($($args)*),
LogLevel::INFO => ::tracing::info!($($args)*), LogLevel::INFO => LogTracing::info!($($args)*),
LogLevel::WARN => ::tracing::warn!($($args)*), LogLevel::WARN => LogTracing::warn!($($args)*),
LogLevel::ERROR => ::tracing::error!($($args)*), LogLevel::ERROR => LogTracing::error!($($args)*),
} }
}}; }};
} }