logger: oh, with_extension is replace, not append

This commit is contained in:
Mikaël Cluseau
2025-07-21 10:11:05 +02:00
parent 852738bec3
commit 4ccda5039b
2 changed files with 8 additions and 6 deletions

View File

@ -285,14 +285,16 @@ pub async fn log_files(log_path: &str, log_name: &str) -> std::io::Result<Vec<Lo
continue;
};
let (name, compressed) = file_name
.strip_suffix(".zst")
.map_or((file_name, false), |s| (s, true));
let Some(name) = name.strip_suffix(".log") else {
let Some((name, ext)) = file_name.rsplit_once('.') else {
continue;
};
let compressed = match ext {
"zst" => true,
"log" => false,
_ => continue,
};
let Some((name, timestamp)) = name.rsplit_once('.') else {
continue;
};

View File

@ -20,7 +20,7 @@ case $test in
;;
log-ls)
$dkl log --log-path tmp/log bash ls
$dkl log --log-path tmp/log bash ls -l
;;
log-cat)
$dkl log --log-path tmp/log bash cat 20250720_12 20301231_23