Struct timely::logging_core::Logger
source · pub struct Logger<T> { /* private fields */ }
Expand description
A buffering logger.
Implementations§
source§impl<T> Logger<T>
impl<T> Logger<T>
sourcepub fn new<F>(time: Instant, offset: Duration, action: F) -> Logger<T>
pub fn new<F>(time: Instant, offset: Duration, action: F) -> Logger<T>
Allocates a new shareable logger bound to a write destination.
sourcepub fn log<S>(&self, event: S)where
S: Into<T>,
pub fn log<S>(&self, event: S)where
S: Into<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.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Logger<T>
impl<T> !RefUnwindSafe for Logger<T>
impl<T> !Send for Logger<T>
impl<T> !Sync for Logger<T>
impl<T> Unpin for Logger<T>
impl<T> !UnwindSafe for Logger<T>
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)