Address PR feedback

pull/269/head
pqnga 2 years ago
parent 1c937cdbc6
commit e787610afe

@ -95,10 +95,9 @@ impl TimezoneStrategy {
pub fn get_now(&self) -> OffsetDateTime {
match self {
TimezoneStrategy::UseUtc => OffsetDateTime::now_utc(),
TimezoneStrategy::UseLocal => match OffsetDateTime::now_local() {
Ok(v) => v,
Err(_) => OffsetDateTime::now_utc() // Fallback to UTC since Rust cannot determine local timezone
}
TimezoneStrategy::UseLocal => {
OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc())
} // Fallback to UTC since Rust cannot determine local timezone
}
}
}
@ -361,7 +360,8 @@ fn get_log_file_path(
let to = dir.as_ref().join(format!(
"{}_{}.log",
app_name,
timezone_strategy.get_now()
timezone_strategy
.get_now()
.format(
&time::format_description::parse(
"[year]-[month]-[day]_[hour]-[minute]-[second]"

Loading…
Cancel
Save