Struct timely_logging::Logger[][src]

pub struct Logger<T, E> { /* fields omitted */ }

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]

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]

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]

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

impl<T, E> !UnwindSafe for Logger<T, E>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.