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

@@ -41,6 +41,7 @@
- 修复日志页面按钮功能混淆问题 - 修复日志页面按钮功能混淆问题
- 修复日志等级设置保存问题 - 修复日志等级设置保存问题
- 修复日志等级异常过滤 - 修复日志等级异常过滤
- 修复清理日志天数功能异常
- 修复偶发性启动卡死问题 - 修复偶发性启动卡死问题
- 修复首页虚拟网卡开关在管理模式下的状态问题 - 修复首页虚拟网卡开关在管理模式下的状态问题

View File

@@ -390,7 +390,7 @@ impl IVerge {
auto_close_connection: Some(true), auto_close_connection: Some(true),
auto_check_update: Some(true), auto_check_update: Some(true),
enable_builtin_enhanced: 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_url: None,
webdav_username: None, webdav_username: None,
webdav_password: None, webdav_password: None,

View File

@@ -78,14 +78,16 @@ pub fn delete_log() -> Result<()> {
verge.auto_log_clean.unwrap_or(0) verge.auto_log_clean.unwrap_or(0)
}; };
// 1: 1天, 2: 7天, 3: 30天, 4: 90天
let day = match auto_log_clean { let day = match auto_log_clean {
1 => 7, 1 => 1,
2 => 30, 2 => 7,
3 => 90, 3 => 30,
4 => 90,
_ => return Ok(()), _ => 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 // %Y-%m-%d to NaiveDateTime
let parse_time_str = |s: &str| { let parse_time_str = |s: &str| {

View File

@@ -2,13 +2,13 @@ import { forwardRef, useImperativeHandle, useState } from "react";
import { useLockFn } from "ahooks"; import { useLockFn } from "ahooks";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { import {
InputAdornment,
List, List,
ListItem, ListItem,
ListItemText, ListItemText,
MenuItem, MenuItem,
Select, Select,
TextField, TextField,
InputAdornment,
} from "@mui/material"; } from "@mui/material";
import { useVerge } from "@/hooks/use-verge"; import { useVerge } from "@/hooks/use-verge";
import { BaseDialog, DialogRef, Switch } from "@/components/base"; import { BaseDialog, DialogRef, Switch } from "@/components/base";
@@ -185,6 +185,7 @@ export const MiscViewer = forwardRef<DialogRef>((props, ref) => {
})) }))
} }
> >
{/* 1: 1天, 2: 7天, 3: 30天, 4: 90天*/}
{[ {[
{ key: t("Never Clean"), value: 0 }, { key: t("Never Clean"), value: 0 },
{ key: t("Retain _n Days", { n: 1 }), value: 1 }, { key: t("Retain _n Days", { n: 1 }), value: 1 },