pub struct LiveFilter { /* private fields */ }Expand description
A filter that can be replaced while the logger is running.
Cloning shares the same underlying filter, so a handle kept by an admin endpoint retunes every logger built from it.
§Examples
use ash_log::*;
use std::sync::Arc;
let filter = LiveFilter::new(FilterDirectives::parse("info"));
let logger = ash_logger!(
backend: Arc::new(NoopAuditBackend),
filter: filter.clone(),
min_level: AuditSeverity::Trace,
);
ash_debug!(logger, "not recorded at info");
// Retune without rebuilding the logger.
filter.set(FilterDirectives::parse("debug"));
ash_debug!(logger, "recorded now");Implementations§
Source§impl LiveFilter
impl LiveFilter
Sourcepub fn new(directives: FilterDirectives) -> Self
pub fn new(directives: FilterDirectives) -> Self
Wrap directives in a handle that can be updated later.
Sourcepub fn set(&self, directives: FilterDirectives)
pub fn set(&self, directives: FilterDirectives)
Replace the directives. Takes effect on the next event.
Sourcepub fn level_for(&self, module: &str) -> AuditSeverity
pub fn level_for(&self, module: &str) -> AuditSeverity
The threshold currently applying to module.
Sourcepub fn snapshot(&self) -> FilterDirectives
pub fn snapshot(&self) -> FilterDirectives
A snapshot of the current directives.
Trait Implementations§
Source§impl Clone for LiveFilter
impl Clone for LiveFilter
Source§impl Debug for LiveFilter
impl Debug for LiveFilter
Auto Trait Implementations§
impl Forget for LiveFilter
impl Freeze for LiveFilter
impl Move for LiveFilter
impl RefUnwindSafe for LiveFilter
impl Send for LiveFilter
impl Sync for LiveFilter
impl Unpin for LiveFilter
impl UnsafeUnpin for LiveFilter
impl UnwindSafe for LiveFilter
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