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]

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

[src]

Sets a new slave logger.

[src]

Stubs out the logger.

Sets the slave logger to one that does nothing (eg. Dummy).

Trait Implementations

impl Log for Reroute
[src]

[src]

Determines if a log message with the specified metadata would be logged. Read more

[src]

Logs the Record. Read more

[src]

Flushes any buffered records.

impl Default for Reroute
[src]

[src]

Creates a reroute with a Dummy slave logger.

Auto Trait Implementations

impl Send for Reroute

impl Sync for Reroute