Struct timely_logging::Logger [−][src]
pub struct Logger<T, E> { /* fields omitted */ }
A buffering logger.
Methods
impl<T, E: Clone> Logger<T, E>
[src]
impl<T, E: Clone> Logger<T, E>
pub fn new<F>(time: Instant, id: E, action: F) -> Self where
F: FnMut(&Duration, &mut Vec<(Duration, E, T)>) + 'static,
[src]
pub fn new<F>(time: Instant, id: E, action: F) -> Self where
F: FnMut(&Duration, &mut Vec<(Duration, E, T)>) + 'static,
Allocates a new shareable logger bound to a write destination.
pub fn log<S: Into<T>>(&self, event: S)
[src]
pub fn log<S: Into<T>>(&self, event: S)
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.
pub fn flush(&mut self)
[src]
pub fn flush(&mut self)
Flushes logged messages and communicates the new minimal timestamp.
Trait Implementations
impl<T, E: Clone> Clone for Logger<T, E>
[src]
impl<T, E: Clone> Clone for Logger<T, E>
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T, E> Drop for Logger<T, E>
[src]
impl<T, E> Drop for Logger<T, E>
Bit weird, because we only have to flush on the last drop, but this should be ok.