pub struct TypedLogger<CB: ContainerBuilder, T> { /* private fields */ }
Expand description
A logger that’s typed to specific events. Its log
functions accept events that can be
converted into T
. Dereferencing a TypedLogger
gives you a Logger
that can log any
compatible type.
Construct a TypedLogger
with Logger::into_typed
or by calling into
on a Logger
.
Implementations§
Source§impl<CB: ContainerBuilder, T> TypedLogger<CB, T>
impl<CB: ContainerBuilder, T> TypedLogger<CB, T>
Sourcepub fn log<S: Into<T>>(&self, event: S)
pub fn log<S: Into<T>>(&self, event: S)
Logs an event. Equivalent to Logger::log
, with the exception that it converts the
event to T
before logging.
Sourcepub fn log_many<I>(&self, events: I)
pub fn log_many<I>(&self, events: I)
Logs multiple events. Equivalent to Logger::log_many
, with the exception that it
converts the events to T
before logging.
Methods from Deref<Target = Logger<CB>>§
Sourcepub fn log<T>(&self, event: T)
pub fn log<T>(&self, event: T)
Logs an event.
The event has its timestamp recorded at the moment of logging, but it may be delayed due to buffering. It will be written when the logger is next flushed, either due to the buffer reaching capacity or a direct call to flush.
This implementation borrows a shared (but thread-local) buffer of log events, to ensure
that the action
only sees one stream of events with increasing timestamps. This may
have a cost that we don’t entirely understand.
Sourcepub fn log_many<I>(&self, events: I)
pub fn log_many<I>(&self, events: I)
Logs multiple events.
The event has its timestamp recorded at the moment of logging, but it may be delayed due to buffering. It will be written when the logger is next flushed, either due to the buffer reaching capacity or a direct call to flush.
All events in this call will have the same timestamp. This can be more performant due
to fewer time.elapsed()
calls, but it also allows some logged events to appear to be
“transactional”, occurring at the same moment.
This implementation borrows a shared (but thread-local) buffer of log events, to ensure
that the action
only sees one stream of events with increasing timestamps. This may
have a cost that we don’t entirely understand.