pub struct LogBufFile {
pub level: Level,
pub format: LogFormat,
pub file_path: Box<Path>,
pub flush_millis: usize,
pub rotation: Option<Rotation>,
}Expand description
Config for buffered file sink which merged I/O and delay flush
Fields§
§level: Levelmax log level in this file
format: LogFormat§file_path: Box<Path>path: dir/name
flush_millis: usizedefault to 0, means always flush when no more message to write.
when larger than zero, will wait for new message when timeout occur.
rotation: Option<Rotation>Rotation config
Implementations§
Source§impl LogBufFile
impl LogBufFile
Sourcepub fn new<P1, P2>(
dir: P1,
file_name: P2,
level: Level,
format: LogFormat,
flush_millis: usize,
) -> Self
pub fn new<P1, P2>( dir: P1, file_name: P2, level: Level, format: LogFormat, flush_millis: usize, ) -> Self
Construct config for file sink with buffer.
Will try to create dir if not exists. Periodic flush if flush_millis is zero, or buffer size reaching 4096. will ensure a complete line write to the log file.
§Arguments:
The type of dir and file_name can be &str / String / &OsStr / OsString / Path / PathBuf. They can be of
different types.
-
flush_millis:-
default to 0, means always flush when no more message to write.
-
when larger than zero, will wait for new message when timeout occur. The max value is 1000 (1 sec).
-
pub fn rotation(self, ro: Rotation) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogBufFile
impl RefUnwindSafe for LogBufFile
impl Send for LogBufFile
impl Sync for LogBufFile
impl Unpin for LogBufFile
impl UnwindSafe for LogBufFile
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