Struct timely::logging_core::Registry

source ·
pub struct Registry { /* private fields */ }

Implementations§

source§

impl Registry

source

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

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).

source

pub fn insert_logger<T>( &mut self, name: &str, logger: Logger<T>, ) -> Option<Box<dyn Any>>
where T: 'static,

Binds a log name to a logger.

source

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

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.

source

pub fn get<T>(&self, name: &str) -> Option<Logger<T>>
where T: 'static,

Retrieves a shared logger, if one has been inserted.

source

pub fn new(time: Instant) -> Registry

Creates a new logger registry.

source

pub fn flush(&mut self)

Flushes all registered logs.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CopyAs<T> for T

source§

fn copy_as(self) -> T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.