[−][src]Struct spirit_log::background::AsyncLogger
A logger that postpones the logging into a background thread.
Note that to not lose messages, the logger need to be flushed.
Either manually:
log::logger().flush();
Or by dropping the FlushGuard
(this is useful to flush even in non-success cases or as
integrations with other utilities).
fn main() { let _guard = FlushGuard; // The rest of the application code. }
Note that even with this, things like std::process::exit
will allow messages to be lost.
Implementations
impl AsyncLogger
[src]
pub fn new(logger: Box<dyn Log>, buffer: usize, mode: OverflowMode) -> Self
[src]
Sends the given logger to a background thread.
Params
logger
: The logger to use in the background thread.buffer
: How many messages there can be waiting in the channel to the background thread.mode
: What to do if a message doesn't fit into the channel.
Panics
- If the buffer size is 0.
- If the
AdaptiveDrop
fill_limit
is zero or larger or equal tobuffer
.
Trait Implementations
impl Drop for AsyncLogger
[src]
fn drop(&mut self)
[src]
Flushes the logger before going away, to make sure log messages are not lost.
As much as it's possible to ensure.
impl Log for AsyncLogger
[src]
Auto Trait Implementations
impl !RefUnwindSafe for AsyncLogger
impl Send for AsyncLogger
impl Sync for AsyncLogger
impl Unpin for AsyncLogger
impl !UnwindSafe for AsyncLogger
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<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>,