From 17cc1fa8a314d474c0c5da1e2f7435b9b2b5890a Mon Sep 17 00:00:00 2001 From: AoXuan Date: Tue, 2 Sep 2025 16:58:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4logger=E3=80=82?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=94=B9=E4=B8=BAconsole=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/electron/services/pythonService.ts | 4 +- .../src/api/models/GeneralConfig_Script.ts | 107 +++--- frontend/src/components/LogViewer.vue | 344 ------------------ .../components/initialization/AdminCheck.vue | 4 +- .../components/initialization/AutoMode.vue | 11 +- .../components/initialization/ManualMode.vue | 49 ++- frontend/src/main.ts | 5 - frontend/src/router/index.ts | 6 - frontend/src/utils/config.ts | 9 +- frontend/src/utils/logger.ts | 192 ---------- frontend/src/views/Initialization.vue | 10 +- frontend/src/views/Logs.vue | 55 --- frontend/src/views/Settings.vue | 6 +- 13 files changed, 88 insertions(+), 714 deletions(-) delete mode 100644 frontend/src/components/LogViewer.vue delete mode 100644 frontend/src/utils/logger.ts delete mode 100644 frontend/src/views/Logs.vue diff --git a/frontend/electron/services/pythonService.ts b/frontend/electron/services/pythonService.ts index e700959..121c2de 100644 --- a/frontend/electron/services/pythonService.ts +++ b/frontend/electron/services/pythonService.ts @@ -516,7 +516,7 @@ export async function startBackend(appRoot: string): Promise<{ success: boolean; // ✅ 重要:也要监听 stderr backendProcess.stderr?.on('data', data => { const output = data.toString() - console.error('Backend error:', output) // 保留原有日志 + console.log('Backend output:', output) // 保留原有日志 // ✅ 在 stderr 中也检查启动标志 if (output.includes('Uvicorn running') || output.includes('36163')) { @@ -526,7 +526,7 @@ export async function startBackend(appRoot: string): Promise<{ success: boolean; }) backendProcess.stderr?.on('data', data => { - console.error('Backend error:', data.toString()) + console.log('Backend output:', data.toString()) }) backendProcess.on('error', error => { diff --git a/frontend/src/api/models/GeneralConfig_Script.ts b/frontend/src/api/models/GeneralConfig_Script.ts index 9d1f4d4..8367c45 100644 --- a/frontend/src/api/models/GeneralConfig_Script.ts +++ b/frontend/src/api/models/GeneralConfig_Script.ts @@ -3,57 +3,56 @@ /* tslint:disable */ /* eslint-disable */ export type GeneralConfig_Script = { - /** - * 脚本可执行文件路径 - */ - ScriptPath?: (string | null); - /** - * 脚本启动附加命令参数 - */ - Arguments?: (string | null); - /** - * 是否追踪脚本子进程 - */ - IfTrackProcess?: (boolean | null); - /** - * 配置文件路径 - */ - ConfigPath?: (string | null); - /** - * 配置文件类型: 单个文件, 文件夹 - */ - ConfigPathMode?: ('File' | 'Folder' | null); - /** - * 更新配置时机, 从不, 仅成功时, 仅失败时, 任务结束时 - */ - UpdateConfigMode?: ('Never' | 'Success' | 'Failure' | 'Always' | null); - /** - * 日志文件路径 - */ - LogPath?: (string | null); - /** - * 日志文件名格式 - */ - LogPathFormat?: (string | null); - /** - * 日志时间戳开始位置 - */ - LogTimeStart?: (number | null); - /** - * 日志时间戳结束位置 - */ - LogTimeEnd?: (number | null); - /** - * 日志时间戳格式 - */ - LogTimeFormat?: (string | null); - /** - * 成功时日志 - */ - SuccessLog?: (string | null); - /** - * 错误时日志 - */ - ErrorLog?: (string | null); -}; - + /** + * 脚本可执行文件路径 + */ + ScriptPath?: string | null + /** + * 脚本启动附加命令参数 + */ + Arguments?: string | null + /** + * 是否追踪脚本子进程 + */ + IfTrackProcess?: boolean | null + /** + * 配置文件路径 + */ + ConfigPath?: string | null + /** + * 配置文件类型: 单个文件, 文件夹 + */ + ConfigPathMode?: 'File' | 'Folder' | null + /** + * 更新配置时机, 从不, 仅成功时, 仅失败时, 任务结束时 + */ + UpdateConfigMode?: 'Never' | 'Success' | 'Failure' | 'Always' | null + /** + * 日志文件路径 + */ + LogPath?: string | null + /** + * 日志文件名格式 + */ + LogPathFormat?: string | null + /** + * 日志时间戳开始位置 + */ + LogTimeStart?: number | null + /** + * 日志时间戳结束位置 + */ + LogTimeEnd?: number | null + /** + * 日志时间戳格式 + */ + LogTimeFormat?: string | null + /** + * 成功时日志 + */ + SuccessLog?: string | null + /** + * 错误时日志 + */ + ErrorLog?: string | null +} diff --git a/frontend/src/components/LogViewer.vue b/frontend/src/components/LogViewer.vue deleted file mode 100644 index c890ad5..0000000 --- a/frontend/src/components/LogViewer.vue +++ /dev/null @@ -1,344 +0,0 @@ - - - - - \ No newline at end of file diff --git a/frontend/src/components/initialization/AdminCheck.vue b/frontend/src/components/initialization/AdminCheck.vue index 9865b60..46492b7 100644 --- a/frontend/src/components/initialization/AdminCheck.vue +++ b/frontend/src/components/initialization/AdminCheck.vue @@ -13,15 +13,13 @@ diff --git a/frontend/src/components/initialization/AutoMode.vue b/frontend/src/components/initialization/AutoMode.vue index 152b590..7339565 100644 --- a/frontend/src/components/initialization/AutoMode.vue +++ b/frontend/src/components/initialization/AutoMode.vue @@ -39,12 +39,11 @@ - - diff --git a/frontend/src/views/Settings.vue b/frontend/src/views/Settings.vue index 10d8ced..e2ca012 100644 --- a/frontend/src/views/Settings.vue +++ b/frontend/src/views/Settings.vue @@ -687,11 +687,7 @@ onMounted(() => { -
-

系统日志

-

查看应用运行日志,用于问题排查和调试

- -
+