[−][src]Struct log_reroute::Reroute
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
impl Reroute
[src]
pub fn new() -> Self
[src]
Creates a new Reroute
logger.
No destination is set yet (it's sent to the Dummy
instance), therefore all log messages
are thrown away.
pub fn reroute_boxed(&self, log: Box<dyn 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.
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.
pub fn reroute_arc(&self, log: Arc<Box<dyn Log>>)
[src]
Sets a slave logger.
Another variant of reroute_boxed
, accepting the inner
representation. This can be combined with a previous get
.
pub fn reroute<L: Log + 'static>(&self, log: L)
[src]
Sets a new slave logger.
See reroute_boxed
for more details.
pub fn clear(&self)
[src]
Stubs out the logger.
Sets the slave logger to one that does nothing (eg. Dummy
).
pub fn get(&self) -> Arc<Box<dyn Log>>
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Reroute
impl Send for Reroute
impl Sync for Reroute
impl Unpin for Reroute
impl !UnwindSafe for Reroute
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,