Struct timely_logging::Logger [−][src]
A buffering logger.
Implementations
impl<T, E: Clone> Logger<T, E>
[src]
pub fn new<F>(time: Instant, offset: Duration, id: E, action: F) -> Self where
F: FnMut(&Duration, &mut Vec<(Duration, E, T)>) + 'static,
[src]
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]
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 log_many<I>(&self, events: I) where
I: IntoIterator,
I::Item: Into<T>,
[src]
I: IntoIterator,
I::Item: Into<T>,
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.
pub fn flush(&mut self)
[src]
Flushes logged messages and communicates the new minimal timestamp.
Trait Implementations
impl<T, E: Clone> Clone for Logger<T, E>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, E> Drop for Logger<T, E>
[src]
Bit weird, because we only have to flush on the last drop, but this should be ok.
Auto Trait Implementations
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> where
E: Unpin,
E: Unpin,
impl<T, E> !UnwindSafe for Logger<T, E>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,