Struct slog_async::AsyncGuard[][src]

pub struct AsyncGuard { /* fields omitted */ }
Expand description

Async guard

All Drains are reference-counted by every Logger that uses them. Async drain runs a worker thread and sends a termination (and flushing) message only when being droped. Because of that it’s actually quite easy to have a left-over reference to a Async drain, when terminating: especially on panics or similar unwinding event. Typically it’s caused be a leftover reference like Logger in thread-local variable, global variable, or a thread that is not being joined on. It might be a program bug, but logging should work reliably especially in case of bugs.

AsyncGuard is a remedy: it will send a flush and termination message to a Async worker thread, and wait for it to finish on it’s own drop. Using it is a simplest way to guarantee log flushing when using slog_async.

Trait Implementations

Executes the destructor for this type. Read more

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.