pub struct LogWrap {
pub enabled: Box<dyn Fn(&dyn Log, &Metadata<'_>) -> bool + Send + Sync>,
pub log: Box<dyn Fn(&dyn Log, &Record<'_>) + Send + Sync>,
pub logger: Box<dyn Log>,
}
Expand description
log wrapper
Fields§
§enabled: Box<dyn Fn(&dyn Log, &Metadata<'_>) -> bool + Send + Sync>
§log: Box<dyn Fn(&dyn Log, &Record<'_>) + Send + Sync>
§logger: Box<dyn Log>
Implementations§
Source§impl LogWrap
Basic log-wrapper methods
impl LogWrap
Basic log-wrapper methods
pub fn new(logger: Box<dyn Log>) -> Self
Sourcepub fn init(self) -> Result<(), SetLoggerError>
pub fn init(self) -> Result<(), SetLoggerError>
Make self as the default logger
Sourcepub fn init_with_default_level(self) -> Result<(), SetLoggerError>
pub fn init_with_default_level(self) -> Result<(), SetLoggerError>
Make self as the default logger, set set the max level
Sourcepub fn log(
self,
f: impl Fn(&dyn Log, &Record<'_>) + Send + Sync + 'static,
) -> Self
pub fn log( self, f: impl Fn(&dyn Log, &Record<'_>) + Send + Sync + 'static, ) -> Self
Intecept the log::Log::log
method, callback function’s first param is the original Log object
Sourcepub fn chain(
self,
f: impl Fn(&dyn Log, &Record<'_>) + Send + Sync + 'static,
) -> Self
pub fn chain( self, f: impl Fn(&dyn Log, &Record<'_>) + Send + Sync + 'static, ) -> Self
Intecept the log::Log::log
method in append mode, new callback and old callback are all enabled
Source§impl LogWrap
impl LogWrap
Sourcepub fn black_module(
self,
mods: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn black_module( self, mods: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Discard the log output by these blacked modules
Sourcepub fn enable_thread_capture(self) -> Self
pub fn enable_thread_capture(self) -> Self
Enable log-capturing
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogWrap
impl !RefUnwindSafe for LogWrap
impl Send for LogWrap
impl Sync for LogWrap
impl Unpin for LogWrap
impl !UnwindSafe for LogWrap
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