Struct primitives::util::logging::Async
pub struct Async { /* private fields */ }Expand description
Async drain
Async will send all the logging records to a wrapped drain running in
another thread.
Async never returns AsyncError::Full.
Records are passed to the worker thread through a channel with a bounded
size (see AsyncBuilder::chan_size). On channel overflow Async will
start dropping Records and log a message informing about it after
sending more Records is possible again. The exact details of handling
overflow is implementation defined, might change and should not be relied
on, other than message won’t be dropped as long as channel does not
overflow.
Any messages reported by Async will contain slog-async logging Record
tag to allow easy custom handling.
Note: On drop Async waits for it’s worker-thread to finish (after handling
all previous Records sent to it). If you can’t tolerate the delay, make
sure you drop it eg. in another thread.
Implementations
impl Async
impl Async
pub fn default<D>(drain: D) -> Asyncwhere
D: 'static + Drain<Err = NeverStruct, Ok = ()> + Send,
pub fn default<D>(drain: D) -> Asyncwhere
D: 'static + Drain<Err = NeverStruct, Ok = ()> + Send,
New AsyncCore with default parameters
pub fn new<D>(drain: D) -> AsyncBuilder<D>where
D: 'static + Drain<Err = NeverStruct, Ok = ()> + Send,
pub fn new<D>(drain: D) -> AsyncBuilder<D>where
D: 'static + Drain<Err = NeverStruct, Ok = ()> + Send,
Build Async drain with custom parameters
The wrapped drain must handle all results (Drain<Ok=(),Error=Never>)
since there’s no way to return it back. See slog::DrainExt::fuse() and
slog::DrainExt::ignore_res() for typical error handling strategies.
Trait Implementations
impl Drain for Async
impl Drain for Async
type Err = AsyncError
type Err = AsyncError
Drainfn log(
&self,
record: &Record<'_>,
logger_values: &OwnedKVList
) -> Result<(), AsyncError>
fn log(
&self,
record: &Record<'_>,
logger_values: &OwnedKVList
) -> Result<(), AsyncError>
Record) Read morefn is_enabled(&self, level: Level) -> bool
fn is_enabled(&self, level: Level) -> bool
fn is_critical_enabled(&self) -> bool
fn is_critical_enabled(&self) -> bool
is_enabledfn is_error_enabled(&self) -> bool
fn is_error_enabled(&self) -> bool
is_enabledfn is_warning_enabled(&self) -> bool
fn is_warning_enabled(&self) -> bool
is_enabledfn is_info_enabled(&self) -> bool
fn is_info_enabled(&self) -> bool
is_enabledfn is_debug_enabled(&self) -> bool
fn is_debug_enabled(&self) -> bool
is_enabledfn is_trace_enabled(&self) -> bool
fn is_trace_enabled(&self) -> bool
is_enabledfn filter<F>(self, f: F) -> Filter<Self, F>where
Self: Sized,
F: FilterFn,
fn filter<F>(self, f: F) -> Filter<Self, F>where
Self: Sized,
F: FilterFn,
Drain Read morefn filter_level(self, level: Level) -> LevelFilter<Self>where
Self: Sized,
fn filter_level(self, level: Level) -> LevelFilter<Self>where
Self: Sized,
Drain (by level) Read more