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

Creates a new Reroute logger.

No destination is set yet (it’s sent to the Dummy instance), therefore all log messages are thrown away.

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

Gives access to the inner logger.

Notes

The logger may be still in use by other threads, etc. It may be in use even after the current thread called clear or reroute, at least for a while.

Trait Implementations

Creates a reroute with a Dummy slave logger.

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

Logs the Record. Read more

Flushes any buffered records.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.