pub struct FileLogger {
level: LevelFilter,
target_filter: Box<dyn Fn(&str) -> bool + Send + Sync>,
formatter: Box<dyn Fn(FormatArgs<'_>) -> String + Send + Sync>,
file_path: PathBuf,
dir_path: PathBuf,
file_name: String,
buf_size: usize,
rotate_opts: RotateOptions,
state: Mutex<FileLoggerState>,
}
Fields§
§level: LevelFilter
§target_filter: Box<dyn Fn(&str) -> bool + Send + Sync>
§formatter: Box<dyn Fn(FormatArgs<'_>) -> String + Send + Sync>
§file_path: PathBuf
Absolute path to the main log file
dir_path: PathBuf
§file_name: String
§buf_size: usize
§rotate_opts: RotateOptions
§state: Mutex<FileLoggerState>
Lock for log
Implementations§
Source§impl FileLogger
impl FileLogger
pub fn new_boxed<F1, F2>( level: LevelFilter, target_filter: F1, formatter: F2, file_path: impl AsRef<Path>, buf_size: usize, rotate_opts: RotateOptions, ) -> Result<Box<dyn Log>, Error>
Sourcefn buffered_write_entry(&self, ts: &DateTime<Local>, log_entry_str: &str)
fn buffered_write_entry(&self, ts: &DateTime<Local>, log_entry_str: &str)
Flush if needed, then write to write_buf
Sourcefn flush_buf(&self, state: &mut FileLoggerState)
fn flush_buf(&self, state: &mut FileLoggerState)
Called when buffer becomes full and when log::flush() is called
fn rotate(&self, state: &mut FileLoggerState) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FileLogger
impl !RefUnwindSafe for FileLogger
impl Send for FileLogger
impl Sync for FileLogger
impl Unpin for FileLogger
impl !UnwindSafe for FileLogger
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