pub struct ReplayAwareLogger { /* private fields */ }Expand description
A logger wrapper that can suppress logs during replay based on configuration.
ReplayAwareLogger wraps any Logger implementation and adds replay-aware
behavior. When the is_replay flag in LogInfo is true, the logger will
suppress or allow logs based on the configured ReplayLoggingConfig.
§Example
use durable_execution_sdk::{TracingLogger, ReplayAwareLogger, ReplayLoggingConfig};
use std::sync::Arc;
// Create a replay-aware logger that suppresses all logs during replay
let logger = ReplayAwareLogger::new(
Arc::new(TracingLogger),
ReplayLoggingConfig::SuppressAll,
);
// Create a replay-aware logger that allows errors during replay
let logger_with_errors = ReplayAwareLogger::new(
Arc::new(TracingLogger),
ReplayLoggingConfig::ErrorsOnly,
);Implementations§
Source§impl ReplayAwareLogger
impl ReplayAwareLogger
Sourcepub fn new(inner: Arc<dyn Logger>, config: ReplayLoggingConfig) -> Self
pub fn new(inner: Arc<dyn Logger>, config: ReplayLoggingConfig) -> Self
Creates a new ReplayAwareLogger with the specified configuration.
§Arguments
inner- The underlying logger to delegate toconfig- Configuration for replay logging behavior
§Example
use durable_execution_sdk::{TracingLogger, ReplayAwareLogger, ReplayLoggingConfig};
use std::sync::Arc;
let logger = ReplayAwareLogger::new(
Arc::new(TracingLogger),
ReplayLoggingConfig::SuppressAll,
);Sourcepub fn suppress_replay(inner: Arc<dyn Logger>) -> Self
pub fn suppress_replay(inner: Arc<dyn Logger>) -> Self
Creates a new ReplayAwareLogger that suppresses all logs during replay.
This is a convenience constructor for the most common use case.
§Arguments
inner- The underlying logger to delegate to
Sourcepub fn allow_all(inner: Arc<dyn Logger>) -> Self
pub fn allow_all(inner: Arc<dyn Logger>) -> Self
Creates a new ReplayAwareLogger that allows all logs during replay.
§Arguments
inner- The underlying logger to delegate to
Sourcepub fn config(&self) -> ReplayLoggingConfig
pub fn config(&self) -> ReplayLoggingConfig
Returns the current replay logging configuration.
Trait Implementations§
Source§impl Debug for ReplayAwareLogger
impl Debug for ReplayAwareLogger
Source§impl Logger for ReplayAwareLogger
impl Logger for ReplayAwareLogger
Auto Trait Implementations§
impl Freeze for ReplayAwareLogger
impl !RefUnwindSafe for ReplayAwareLogger
impl Send for ReplayAwareLogger
impl Sync for ReplayAwareLogger
impl Unpin for ReplayAwareLogger
impl UnsafeUnpin for ReplayAwareLogger
impl !UnwindSafe for ReplayAwareLogger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.