mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Keep separators between time part of logfile names
The timestamp part of the log filename becomes a dense series of numbers because sanitize_filename removes ":" as it is a special character on windows. So use a custom replacement character to fix work around this.
This commit is contained in:
@@ -70,7 +70,14 @@ impl Logger {
|
|||||||
fn open(logdir: &Path) -> Result<(String, fs::File), io::Error> {
|
fn open(logdir: &Path) -> Result<(String, fs::File), io::Error> {
|
||||||
let basename =
|
let basename =
|
||||||
chrono::offset::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
|
chrono::offset::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
|
||||||
let mut fname = sanitize_filename::sanitize(format!("{}.log", &basename));
|
let mut fname = sanitize_filename::sanitize_with_options(
|
||||||
|
format!("{}.log", &basename),
|
||||||
|
sanitize_filename::Options {
|
||||||
|
truncate: true,
|
||||||
|
windows: true,
|
||||||
|
replacement: ".",
|
||||||
|
},
|
||||||
|
);
|
||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
loop {
|
loop {
|
||||||
match std::fs::OpenOptions::new()
|
match std::fs::OpenOptions::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user