pub trait Logger<I> {
type Error;
// Required method
fn log(&mut self, item: I) -> Result<(), Self::Error>;
// Provided methods
fn by_ref(&mut self) -> &mut Self { ... }
fn chain<L>(self, other: L) -> Chain<Self, L>
where Self: Sized { ... }
fn filter<F>(self, f: F) -> Filter<Self, F>
where Self: Sized,
F: FnMut(&I) -> bool { ... }
fn map<F, B>(self, f: F) -> Map<Self, F, B>
where Self: Sized { ... }
fn safe<E>(self) -> Safe<Self, E>
where Self: Sized { ... }
}
Expand description
A logger is a routine that takes input and has side-effects.
See the documentation for the contralog crate for a general overview of loggers.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn chain<L>(self, other: L) -> Chain<Self, L>where
Self: Sized,
fn chain<L>(self, other: L) -> Chain<Self, L>where
Self: Sized,
Combine two loggers, creating a new logger that logs each input to both loggers.
Sourcefn filter<F>(self, f: F) -> Filter<Self, F>
fn filter<F>(self, f: F) -> Filter<Self, F>
Apply a function to each input and pass it to the logger only if the function returns true for it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.