Trait slog::Drain
[−]
[src]
pub trait Drain { type Error; fn log(
&self,
info: &Record,
_: &OwnedKeyValueList
) -> Result<(), Self::Error>; }
Logging drain
Drains generally mean destination for logs, but slog generalize the
term. Drain
s are responsible for filtering, modifying, formatting
and writing the log records into given destination.
Implementing this trait allows writing own Drains, that can be combined with other drains.
Associated Types
type Error
Type of potential errors returned during logging
Required Methods
fn log(&self, info: &Record, _: &OwnedKeyValueList) -> Result<(), Self::Error>
Log one logging record
Every logging Record
built from a logging statement (eg.
info!(...)
), and key-value lists of a Logger
it was executed on
will be passed to the root drain registered during Logger::root
.
Typically Drain
s:
- pass this information (or not) to the sub-logger(s) (filters)
- format and write the information the a destination (writers)
- deal with the errors returned from the sub-logger(s)
Implementations on Foreign Types
impl<D: Drain + ?Sized> Drain for Box<D>
[src]
impl<D: Drain + ?Sized> Drain for Arc<D>
[src]
Implementors
impl Drain for Discard type Error = Never;
impl<D: Drain> Drain for Filter<D> type Error = D::Error;
impl<D: Drain, E> Drain for MapError<D, E> type Error = E;
impl<D: Drain> Drain for LevelFilter<D> type Error = D::Error;
impl<D1: Drain, D2: Drain> Drain for Duplicate<D1, D2> type Error = DuplicateError<D1::Error, D2::Error>;
impl<D: Drain> Drain for Fuse<D> where
D::Error: Display, type Error = Never;impl<D: Drain> Drain for IgnoreErr<D> type Error = Never;