Struct timely::logging_core::Logger
source · pub struct Logger<T, E> { /* private fields */ }
Expand description
A buffering logger.
Implementations§
source§impl<T, E> Logger<T, E>where
E: Clone,
impl<T, E> Logger<T, E>where
E: Clone,
sourcepub fn new<F>(time: Instant, offset: Duration, id: E, action: F) -> Logger<T, E>
pub fn new<F>(time: Instant, offset: Duration, id: E, action: F) -> Logger<T, E>
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, E> Freeze for Logger<T, E>
impl<T, E> !RefUnwindSafe for Logger<T, E>
impl<T, E> !Send for Logger<T, E>
impl<T, E> !Sync for Logger<T, E>
impl<T, E> Unpin for Logger<T, E>
impl<T, E> !UnwindSafe for Logger<T, E>
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
)