fix: can not filiter log level as expected

This commit is contained in:
Tunglies
2025-08-03 09:52:27 +08:00
parent 3eb2a5b3ef
commit d16c691c0f
10 changed files with 83 additions and 44 deletions

View File

@@ -30,6 +30,8 @@ import { initGlobalLogService } from "@/services/global-log-service";
import { invoke } from "@tauri-apps/api/core";
import { showNotice } from "@/services/noticeService";
import { NoticeManager } from "@/components/base/NoticeManager";
import { useLocalStorage } from "foxact/use-local-storage";
import { LogLevel } from "@/hooks/use-log-data";
const appWindow = getCurrentWebviewWindow();
export let portableFlag = false;
@@ -154,6 +156,7 @@ const Layout = () => {
const { verge } = useVerge();
const { clashInfo } = useClashInfo();
const [enableLog] = useEnableLog();
const [logLevel] = useLocalStorage<LogLevel>("log:log-level", "info");
const { language, start_page } = verge ?? {};
const navigate = useNavigate();
const location = useLocation();
@@ -184,9 +187,9 @@ const Layout = () => {
useEffect(() => {
if (clashInfo) {
const { server = "", secret = "" } = clashInfo;
initGlobalLogService(enableLog, "info");
initGlobalLogService(enableLog, logLevel);
}
}, [clashInfo, enableLog]);
}, [clashInfo, enableLog, logLevel]);
// 设置监听器
useEffect(() => {