refactor: simplify log retrieval by removing level parameter and relying on server-side filtering #4293

This commit is contained in:
Tunglies
2025-08-13 01:15:33 +08:00
parent 45e69543b3
commit 558e28ddaf
6 changed files with 79 additions and 107 deletions

View File

@@ -412,8 +412,8 @@ export async function gc() {
return invoke<void>("clash_gc");
}
export async function getClashLogs(level?: string) {
return invoke<any>("get_clash_logs", { level });
export async function getClashLogs() {
return invoke<any>("get_clash_logs");
}
export async function startLogsMonitoring(level?: string) {

View File

@@ -44,8 +44,9 @@ export const fetchLogsViaIPC = async (
logLevel: LogLevel = "info",
): Promise<ILogItem[]> => {
try {
const level = logLevel === "all" ? undefined : logLevel;
const response = await getClashLogs(level);
// Server-side filtering handles the level via /logs?level={level}
// We just fetch all cached logs regardless of the logLevel parameter
const response = await getClashLogs();
// The response should be in the format expected by the frontend
// Transform the logs to match the expected format