[][src]Struct timely_logging::Registry

pub struct Registry<Id> { /* fields omitted */ }

Methods

impl<Id: Clone + 'static> Registry<Id>[src]

pub fn insert<T: 'static, F: FnMut(&Duration, &mut Vec<(Duration, Id, T)>) + 'static>(
    &mut self,
    name: &str,
    action: F
) -> Option<Box<dyn Any>>
[src]

Binds a log name to an action on log event batches.

This method also returns any pre-installed action, rather than overwriting it and pivoting the logging destination mid-stream. New loggers with this name will use the new destination, and existing loggers will use the old destination.

The action should respond to a sequence of events with non-decreasing timestamps (Durations) and well as a timestamp that lower bounds the next event that could be seen (likely greater or equal to the timestamp of the last event). The end of a logging stream is indicated only by dropping the associated action, which can be accomplished with remove (or a call to insert, though this is not recommended).

pub fn remove(&mut self, name: &str) -> Option<Box<dyn Any>>[src]

Removes a bound logger.

This is intended primarily to close a logging stream and let the associated writer communicate that the stream is closed to any consumers. If a binding is not removed, then the stream cannot be complete as in principle anyone could acquire a handle to the logger and start further logging.

pub fn get<T: 'static>(&self, name: &str) -> Option<Logger<T, Id>>[src]

Retrieves a shared logger, if one has been inserted.

pub fn new(time: Instant, id: Id) -> Self[src]

Creates a new logger registry.

pub fn flush(&mut self)[src]

Flushes all registered logs.

Auto Trait Implementations

impl<Id> !Send for Registry<Id>

impl<Id> !Sync for Registry<Id>

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.