pub struct ConsoleHandler { /* private fields */ }
Expand description
A handler that writes to the console
Implementations§
Source§impl ConsoleHandler
impl ConsoleHandler
Sourcepub fn with_writer(
level: LogLevel,
writer: Box<dyn Write + Send + Sync>,
) -> Self
pub fn with_writer( level: LogLevel, writer: Box<dyn Write + Send + Sync>, ) -> Self
Create a new console handler with a custom writer
Sourcepub fn with_colors(self, use_colors: bool) -> Self
pub fn with_colors(self, use_colors: bool) -> Self
Sets whether to use colors in the output.
Sourcepub fn with_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_pattern(self, pattern: impl Into<String>) -> Self
Sets a custom format pattern.
Sourcepub fn with_format<F>(self, format_fn: F) -> Self
pub fn with_format<F>(self, format_fn: F) -> Self
Sets a custom format function for the handler.
pub fn with_formatter(self, formatter: Formatter) -> Self
pub fn with_filter(self, filter: HandlerFilter) -> Self
Trait Implementations§
Source§impl Clone for ConsoleHandler
impl Clone for ConsoleHandler
Source§impl Debug for ConsoleHandler
impl Debug for ConsoleHandler
Source§impl Default for ConsoleHandler
impl Default for ConsoleHandler
Source§impl Handler for ConsoleHandler
impl Handler for ConsoleHandler
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Check if the handler is enabled
Source§fn set_enabled(&mut self, enabled: bool)
fn set_enabled(&mut self, enabled: bool)
Set whether the handler is enabled
Source§fn set_formatter(&mut self, formatter: Formatter)
fn set_formatter(&mut self, formatter: Formatter)
Set the formatter
Source§fn set_filter(&mut self, filter: Option<HandlerFilter>)
fn set_filter(&mut self, filter: Option<HandlerFilter>)
Set a filter closure for this handler (optional, default: no filter)
Source§fn filter(&self) -> Option<&HandlerFilter>
fn filter(&self) -> Option<&HandlerFilter>
Get the filter closure for this handler (optional)
Source§fn handle_batch(&self, records: &[Record]) -> Result<(), HandlerError>
fn handle_batch(&self, records: &[Record]) -> Result<(), HandlerError>
Handle a batch of log records (optimized implementation)
Auto Trait Implementations§
impl !Freeze for ConsoleHandler
impl !RefUnwindSafe for ConsoleHandler
impl Send for ConsoleHandler
impl Sync for ConsoleHandler
impl Unpin for ConsoleHandler
impl !UnwindSafe for ConsoleHandler
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