fix: correct log cleanup day mapping and update logging level #4434

This commit is contained in:
Tunglies
2025-08-18 19:12:53 +08:00
parent 7fe0381850
commit 85a9f6c8d4
4 changed files with 10 additions and 6 deletions

View File

@@ -390,7 +390,7 @@ impl IVerge {
auto_close_connection: Some(true),
auto_check_update: Some(true),
enable_builtin_enhanced: Some(true),
auto_log_clean: Some(2),
auto_log_clean: Some(2), // 1: 1天, 2: 7天, 3: 30天, 4: 90天
webdav_url: None,
webdav_username: None,
webdav_password: None,

View File

@@ -78,14 +78,16 @@ pub fn delete_log() -> Result<()> {
verge.auto_log_clean.unwrap_or(0)
};
// 1: 1天, 2: 7天, 3: 30天, 4: 90天
let day = match auto_log_clean {
1 => 7,
2 => 30,
3 => 90,
1 => 1,
2 => 7,
3 => 30,
4 => 90,
_ => return Ok(()),
};
log::debug!(target: "app", "try to delete log files, day: {day}");
log::info!(target: "app", "try to delete log files, day: {day}");
// %Y-%m-%d to NaiveDateTime
let parse_time_str = |s: &str| {