Struct log_reroute::Reroute
[−]
[src]
pub struct Reroute { /* fields omitted */ }A logging proxy.
This logger forwards all calls to currently configured slave logger.
The log routing is implemented in a lock-less and wait-less manner. While not necessarily faster than using a mutex (unless there's a lot of contention and the slave logger also doesn't lock), it makes it usable in some weird places (like a signal handler).
The rerouting (eg. changing the slave) is lock-less, but may have to wait for current logging calls to end and concurrent reroutes will block each other.
Note
When switching a logger, no care is taken to pair logging calls. In other words, it is possible a message is written to the old logger and the new logger is flushed. This shouldn't matter in practice, since a logger should flush itself once it is dropped.
Methods
impl Reroute[src]
pub fn reroute_boxed(&self, log: Box<Log>)[src]
Sets a new slave logger.
In case it is already in a box, you should prefer this method over
reroute, since there'll be less indirection.
pub fn reroute<L: Log + 'static>(&self, log: L)[src]
Sets a new slave logger.
pub fn clear(&self)[src]
Stubs out the logger.
Sets the slave logger to one that does nothing (eg. Dummy).
Trait Implementations
impl Log for Reroute[src]
fn enabled(&self, metadata: &Metadata) -> bool[src]
Determines if a log message with the specified metadata would be logged. Read more
fn log(&self, record: &Record)[src]
Logs the Record. Read more
fn flush(&self)[src]
Flushes any buffered records.