Struct log_reroute::Reroute [−][src]
pub struct Reroute { /* fields omitted */ }
Expand description
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, the performance should be more predictable and stable in face of contention from multiple threads. This assumes the slave logger also doesn’t lock.
Implementations
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.
The old logger (if any) is flushed before dropping. In general, loggers should flush themselves on drop, but that may take time. This way we (mostly) ensure the cost of flushing is paid here.
Sets a slave logger.
Another variant of reroute_boxed
, accepting the inner
representation. This can be combined with a previous get
.
Note that the Arc<Box<dyn Log>>
(double indirection) is necessary evil, since arc-swap
can’t accept !Sized
types.
Sets a new slave logger.
See reroute_boxed
for more details.
Stubs out the logger.
Sets the slave logger to one that does nothing (eg. Dummy
).