Struct slog_async::AsyncGuard [−][src]
Async guard
All Drain
s 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 drop
ed. Because of that it’s actually
quite easy to have a left-over reference to a Async
drain, when
terminating: especially on panic
s 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
impl Drop for AsyncGuard
[src]
Auto Trait Implementations
impl !RefUnwindSafe for AsyncGuard
impl Send for AsyncGuard
impl Sync for AsyncGuard
impl Unpin for AsyncGuard
impl !UnwindSafe for AsyncGuard
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,
pub 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> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
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.
pub 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>,