pub struct AppendTimestamp {
pub format: &'static str,
pub file_limit: FileLimit,
pub date_from: DateFrom,
}
Expand description
Append current timestamp as suffix when rotating files. If the timestamp already exists, an additional number is appended.
Current limitations:
- Neither
format
nor the base filename can include the character"."
. - The
format
should ensure that the lexical and chronological orderings are the same
Fields§
§format: &'static str
The format of the timestamp suffix
file_limit: FileLimit
The file limit, e.g. when to delete an old file - by age (given by suffix) or by number of files
date_from: DateFrom
Add timestamp from DateFrom
Implementations§
Trait Implementations§
Source§impl SuffixScheme for AppendTimestamp
impl SuffixScheme for AppendTimestamp
Source§type Repr = TimestampSuffix
type Repr = TimestampSuffix
The representation of suffixes that this suffix scheme uses.
E.g. if the suffix is a number, you can use
usize
.Source§fn rotate_file(
&mut self,
_basepath: &Path,
newest_suffix: Option<&TimestampSuffix>,
suffix: &Option<TimestampSuffix>,
) -> Result<TimestampSuffix>
fn rotate_file( &mut self, _basepath: &Path, newest_suffix: Option<&TimestampSuffix>, suffix: &Option<TimestampSuffix>, ) -> Result<TimestampSuffix>
file-rotate
calls this function when the file at suffix
needs to be rotated, and moves the log file
accordingly. Thus, this function should not move any files itself. Read moreSource§fn too_old(&self, suffix: &TimestampSuffix, file_number: usize) -> bool
fn too_old(&self, suffix: &TimestampSuffix, file_number: usize) -> bool
Whether either the suffix or the chronological file number indicates that the file is old
and should be deleted, depending of course on the file limit.
file_number
starts at 0 for the most recent suffix.Source§fn scan_suffixes(&self, basepath: &Path) -> BTreeSet<SuffixInfo<Self::Repr>>
fn scan_suffixes(&self, basepath: &Path) -> BTreeSet<SuffixInfo<Self::Repr>>
Find all files in the basepath.parent() directory that has path equal to basepath + a valid
suffix. Return sorted collection - sorted from most recent to oldest based on the
Ord implementation of
Self::Repr
.Auto Trait Implementations§
impl Freeze for AppendTimestamp
impl RefUnwindSafe for AppendTimestamp
impl Send for AppendTimestamp
impl Sync for AppendTimestamp
impl Unpin for AppendTimestamp
impl UnwindSafe for AppendTimestamp
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