pub enum TimeZone {
UTC,
Local,
Fix(FixedOffset),
}Expand description
Specifies the time zone to use for log file rotation and log file naming.
This setting affects:
- When age-based rotation occurs (based on the selected time zone)
- How timestamps are formatted in log file names
- Ensuring consistent log timing across different deployment environments
§Examples
use logroller::TimeZone;
use chrono::FixedOffset;
// Use UTC time for global deployments
let utc = TimeZone::UTC;
// Use local system time zone (changes with system settings)
let local = TimeZone::Local;
// Use a fixed offset for a specific region (e.g., UTC+8 for China)
let china = TimeZone::Fix(FixedOffset::east_opt(8 * 3600).unwrap());Variants§
UTC
Use UTC time zone. Best for consistent timing in distributed systems or when deploying across multiple regions.
Local
Use the system’s local time zone. Suitable for single-location deployments where logs should align with local time.
Fix(FixedOffset)
Use a fixed time zone offset. Useful for targeting specific regions or when you need logs to match a particular time zone regardless of where the application runs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimeZone
impl RefUnwindSafe for TimeZone
impl Send for TimeZone
impl Sync for TimeZone
impl Unpin for TimeZone
impl UnwindSafe for TimeZone
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