pub enum RotationPolicy {
FileSize(u64),
Daily {
hour: u32,
minute: u32,
},
Hourly,
Period(Duration),
}
Expand description
Rotation policies for RotatingFileSink
.
Rotation policy defines when and how to split logs into multiple files, during which new log files may be created and old log files may be deleted.
§Error
Note that some parameters have range requirements, functions that receive it will return an error if the requirements are not met.
§Examples
use spdlog::sink::RotationPolicy;
// Rotating every 10 MB file.
RotationPolicy::FileSize(1024 * 1024 * 10);
// Rotating every day at 15:30.
RotationPolicy::Daily { hour: 15, minute: 30 };
// Rotating every hour.
RotationPolicy::Hourly;
// Rotating every 6 hour.
RotationPolicy::Period(Duration::from_secs(6 * 60 * 60));
Variants§
FileSize(u64)
Rotating to a new log file when the size of the current log file exceeds the given limit.
Daily
Rotating to a new log file at a specified time point within a day.
Fields
Hourly
Rotating to a new log file at minute 0 of each hour.
Period(Duration)
Rotating to a new log file after given period (greater then 1 minute) is passed.
Trait Implementations§
Source§impl Clone for RotationPolicy
impl Clone for RotationPolicy
Source§fn clone(&self) -> RotationPolicy
fn clone(&self) -> RotationPolicy
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RotationPolicy
impl Debug for RotationPolicy
Source§impl Hash for RotationPolicy
impl Hash for RotationPolicy
Source§impl PartialEq for RotationPolicy
impl PartialEq for RotationPolicy
impl Copy for RotationPolicy
impl Eq for RotationPolicy
impl StructuralPartialEq for RotationPolicy
Auto Trait Implementations§
impl Freeze for RotationPolicy
impl RefUnwindSafe for RotationPolicy
impl Send for RotationPolicy
impl Sync for RotationPolicy
impl Unpin for RotationPolicy
impl UnwindSafe for RotationPolicy
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