pub struct LoggingObserver { /* private fields */ }Expand description
Built-in observer that logs events to stdout.
This is a simple implementation useful for development and debugging. For production use, consider implementing a custom observer that integrates with your logging/tracing infrastructure.
§Examples
use ferrous_di::{ServiceCollection, LoggingObserver};
use std::sync::Arc;
let mut services = ServiceCollection::new();
services.add_observer(Arc::new(LoggingObserver::new()));
// All resolutions will be logged to stdout
let provider = services.build();Implementations§
Trait Implementations§
Source§impl Default for LoggingObserver
impl Default for LoggingObserver
Source§impl DiObserver for LoggingObserver
impl DiObserver for LoggingObserver
Source§fn resolved(&self, key: &Key, duration: Duration)
fn resolved(&self, key: &Key, duration: Duration)
Called when a service is successfully resolved. Read more
Source§fn factory_panic(&self, key: &Key, message: &str)
fn factory_panic(&self, key: &Key, message: &str)
Called when a factory function panics during resolution. Read more
Source§fn resolving_with_context(&self, key: &Key, context: &ObservationContext)
fn resolving_with_context(&self, key: &Key, context: &ObservationContext)
Called when starting to resolve a service with workflow context. Read more
Source§fn resolved_with_context(
&self,
key: &Key,
duration: Duration,
context: &ObservationContext,
)
fn resolved_with_context( &self, key: &Key, duration: Duration, context: &ObservationContext, )
Called when a service is successfully resolved with workflow context. Read more
Source§fn factory_panic_with_context(
&self,
key: &Key,
message: &str,
context: &ObservationContext,
)
fn factory_panic_with_context( &self, key: &Key, message: &str, context: &ObservationContext, )
Called when a factory function panics during resolution with workflow context. Read more
Auto Trait Implementations§
impl Freeze for LoggingObserver
impl RefUnwindSafe for LoggingObserver
impl Send for LoggingObserver
impl Sync for LoggingObserver
impl Unpin for LoggingObserver
impl UnwindSafe for LoggingObserver
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