Revert "Fix empty and different level naming"

This reverts commit d966ad89e5.
This commit is contained in:
Ethan Brierley 2024-08-28 22:37:11 +01:00 committed by GitHub
parent b0b3b5b8c1
commit b49f8b2198

View file

@ -22,7 +22,6 @@ 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:
// https://github.com/tokio-rs/tracing/issues/2730 // https://github.com/tokio-rs/tracing/issues/2730
#[cfg(feature = "tracing")]
macro_rules! log_retry { macro_rules! log_retry {
($level:expr, $($args:tt)*) => {{ ($level:expr, $($args:tt)*) => {{
match $level { match $level {
@ -35,13 +34,6 @@ macro_rules! log_retry {
}}; }};
} }
#[cfg(all(feature = "log", not(feature = "tracing")))]
macro_rules! log_retry {
($level:expr, $($args:tt)*) => {{
LogTracing::log!($level, $($args)*)
}};
}
/// `RetryTransientMiddleware` offers retry logic for requests that fail in a transient manner /// `RetryTransientMiddleware` offers retry logic for requests that fail in a transient manner
/// and can be safely executed again. /// and can be safely executed again.
/// ///
@ -116,10 +108,7 @@ where
Self { Self {
retry_policy, retry_policy,
retryable_strategy, retryable_strategy,
#[cfg(feature = "tracing")]
retry_log_level: LogLevel::WARN, retry_log_level: LogLevel::WARN,
#[cfg(all(feature = "log", not(feature = "tracing")))]
retry_log_level: LogLevel::Warn,
} }
} }
} }
@ -186,7 +175,6 @@ where
.duration_since(SystemTime::now()) .duration_since(SystemTime::now())
.unwrap_or_else(|_| Duration::default()); .unwrap_or_else(|_| Duration::default());
// Sleep the requested amount before we try again. // Sleep the requested amount before we try again.
#[cfg(any(feature = "log", feature = "tracing"))]
log_retry!( log_retry!(
self.retry_log_level, self.retry_log_level,
"Retry attempt #{}. Sleeping {:?} before the next attempt", "Retry attempt #{}. Sleeping {:?} before the next attempt",