pub struct Rotation {
pub by_age: Option<ByAge>,
pub by_size: Option<u64>,
pub time_fmt: Option<&'static str>,
pub upkeep: Upkeep,
pub archive_dir: Option<PathBuf>,
pub compress_exclude: Option<usize>,
}Expand description
Log rotation configuration.
by_age and by_size can be configured at the same time, means log will be rotate when any of the conditions met.
It’s not valid when by_age and by_size both None.
Fields§
§by_age: Option<ByAge>§by_size: Option<u64>§time_fmt: Option<&'static str>If None, archive in file.<number> form, and Upkeep::Age will be ignore.
If Some, archive in file.<datetime> form.
upkeep: UpkeepHow to cleanup the old file
archive_dir: Option<PathBuf>Whether to move the log into an archive_dir. if not configured, it’s the same dir as current log.
compress_exclude: Option<usize>When Some(count), indicate how many uncompressed archived logs. When 0, all the archive logs are compressed. When None, do not compress archive logs;
Implementations§
Source§impl Rotation
impl Rotation
Sourcepub fn by_size(size_limit: u64, max_files: Option<usize>) -> Self
pub fn by_size(size_limit: u64, max_files: Option<usize>) -> Self
max_files: When None, do not delete old files
pub fn by_age( age: Age, use_last_time: bool, time_fmt: &'static str, max_time: Option<TimeDelta>, ) -> Self
Sourcepub fn compress_exclude(self, un_compress_files: usize) -> Self
pub fn compress_exclude(self, un_compress_files: usize) -> Self
Compress archived logs, with a number of recent files left uncompressed
Sourcepub fn archive_dir<P: Into<PathBuf>>(self, archive_dir: P) -> Self
pub fn archive_dir<P: Into<PathBuf>>(self, archive_dir: P) -> Self
Move the old logs into an archive_dir.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnwindSafe for Rotation
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