[−][src]Struct spirit_log::background::FlushGuard
This, when dropped, flushes the logger.
Unless the logger is flushed, there's a risk of losing messages on application termination.
It can be used either separately or plugged into the spirit Builder
(through the
Extension
trait). In that case, it also turns on the autojoin_bg_thread
option, so the
application actually waits for the spirit thread to terminate and drops the guard.
Note that it's fine to flush the logs multiple times (it only costs some performance, because the flush needs to wait for all the queued messages to be written).
Examples
Spirit::<Empty, Empty>::new() .with_singleton(FlushGuard) .run(|_spirit| { info!("Hello world"); Ok(()) });
Implementations
impl FlushGuard
[src]
pub fn flush()
[src]
Performs the flush of the global logger.
This can be used directly, instead of getting an instance of the FlushGuard
and
dropping it. But both ways have the same effect.
Trait Implementations
impl Drop for FlushGuard
[src]
impl<E> Extension<E> for FlushGuard where
E: Extensible<Ok = E>,
[src]
E: Extensible<Ok = E>,
Auto Trait Implementations
impl RefUnwindSafe for FlushGuard
impl Send for FlushGuard
impl Sync for FlushGuard
impl Unpin for FlushGuard
impl UnwindSafe for FlushGuard
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<B, F, R> Extension<B> for F where
F: FnOnce(B) -> R,
R: IntoResult<B>,
[src]
F: FnOnce(B) -> R,
R: IntoResult<B>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoResult<T> for T
[src]
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>,