Struct timely::logging_core::Registry
source · pub struct Registry { /* private fields */ }
Implementations§
source§impl Registry
impl Registry
sourcepub fn insert<T, F>(&mut self, name: &str, action: F) -> Option<Box<dyn Any>>
pub fn insert<T, F>(&mut self, name: &str, action: F) -> Option<Box<dyn Any>>
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).
sourcepub fn insert_logger<T>(
&mut self,
name: &str,
logger: Logger<T>,
) -> Option<Box<dyn Any>>where
T: 'static,
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.
sourcepub fn remove(&mut self, name: &str) -> Option<Box<dyn Any>>
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.