pub struct Logger<CB>where
CB: ContainerBuilder,{ /* private fields */ }Expand description
A buffering logger.
Implementations§
Source§impl<CB> Logger<CB>where
CB: ContainerBuilder,
impl<CB> Logger<CB>where
CB: ContainerBuilder,
Sourcepub fn new<F>(time: Instant, offset: Duration, action: F) -> Logger<CB>
pub fn new<F>(time: Instant, offset: Duration, action: F) -> Logger<CB>
Allocates a new shareable logger bound to a write destination.
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.
Sourcepub fn into_typed<T>(self) -> TypedLogger<CB, T>
pub fn into_typed<T>(self) -> TypedLogger<CB, T>
Obtain a typed logger.
Trait Implementations§
Source§impl<CB> Clone for Logger<CB>where
CB: ContainerBuilder,
impl<CB> Clone for Logger<CB>where
CB: ContainerBuilder,
Source§impl<CB, T> From<Logger<CB>> for TypedLogger<CB, T>where
CB: ContainerBuilder,
impl<CB, T> From<Logger<CB>> for TypedLogger<CB, T>where
CB: ContainerBuilder,
Source§fn from(inner: Logger<CB>) -> TypedLogger<CB, T>
fn from(inner: Logger<CB>) -> TypedLogger<CB, T>
Auto Trait Implementations§
impl<CB> Freeze for Logger<CB>
impl<CB> !RefUnwindSafe for Logger<CB>
impl<CB> !Send for Logger<CB>
impl<CB> !Sync for Logger<CB>
impl<CB> Unpin for Logger<CB>
impl<CB> !UnwindSafe for Logger<CB>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more