pub struct FileHandler { /* private fields */ }
Expand description
A handler that writes log records to a file
Implementations§
Source§impl FileHandler
impl FileHandler
pub fn new(path: impl AsRef<Path>) -> Result<Self>
pub fn with_level(self, level: LogLevel) -> Self
pub fn with_formatter(self, formatter: Formatter) -> Self
pub fn with_colors(self, use_colors: bool) -> Self
pub fn with_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_format<F>(self, format_fn: F) -> Self
pub fn with_rotation(self, max_size: usize, max_files: usize) -> Self
pub fn with_filter(self, filter: HandlerFilter) -> Self
pub fn with_compression(self, compress: bool) -> Self
pub fn with_batching(self, batch_size: usize) -> Self
Trait Implementations§
Source§impl Clone for FileHandler
impl Clone for FileHandler
Source§impl Debug for FileHandler
impl Debug for FileHandler
Source§impl Handler for FileHandler
impl Handler for FileHandler
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 FileHandler
impl !RefUnwindSafe for FileHandler
impl Send for FileHandler
impl Sync for FileHandler
impl Unpin for FileHandler
impl !UnwindSafe for FileHandler
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