pub struct AsyncBackend { /* private fields */ }Expand description
Writes events on a dedicated thread.
§Examples
use ash_log::*;
use std::sync::Arc;
let backend = AsyncBackend::builder(Arc::new(StdoutAuditBackend))
.capacity(4096)
.overflow(OverflowPolicy::DropAndReport)
.errors(Arc::new(StderrErrorSink))
.build();
let logger = Logger::builder(Arc::new(backend)).build();
logger.info("does not block on the write");
logger.flush(); // waits for the queue to drainImplementations§
Source§impl AsyncBackend
impl AsyncBackend
Sourcepub fn builder(inner: Arc<dyn AuditBackend>) -> AsyncBackendBuilder
pub fn builder(inner: Arc<dyn AuditBackend>) -> AsyncBackendBuilder
Start building an async backend wrapping inner.
Sourcepub fn new(inner: Arc<dyn AuditBackend>) -> Self
pub fn new(inner: Arc<dyn AuditBackend>) -> Self
Wrap inner with default settings: a 1024-event queue that blocks when
full.
Sourcepub fn dropped(&self) -> u64
pub fn dropped(&self) -> u64
Events dropped because the queue was full.
Always 0 under OverflowPolicy::Block.
Trait Implementations§
Source§impl AuditBackend for AsyncBackend
impl AuditBackend for AsyncBackend
Source§impl Debug for AsyncBackend
impl Debug for AsyncBackend
Source§impl Drop for AsyncBackend
impl Drop for AsyncBackend
Auto Trait Implementations§
impl !Freeze for AsyncBackend
impl !RefUnwindSafe for AsyncBackend
impl !UnwindSafe for AsyncBackend
impl Forget for AsyncBackend
impl Move for AsyncBackend
impl Send for AsyncBackend
impl Sync for AsyncBackend
impl Unpin for AsyncBackend
impl UnsafeUnpin for AsyncBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more