mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +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> {
|
||||
let basename =
|
||||
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;
|
||||
loop {
|
||||
match std::fs::OpenOptions::new()
|
||||
|
||||
Reference in New Issue
Block a user