From de4f2599be843a4e9caf913df5fb9275c1410b43 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Sun, 25 Aug 2024 21:37:13 +0800 Subject: [PATCH] refactor: remove unnecessary logs --- src/main/ipc.ts | 1 - src/main/updater.ts | 6 ------ src/main/utils/upgrade.ts | 8 ++++---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/ipc.ts b/src/main/ipc.ts index 2c3b354c..c605bd42 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -50,7 +50,6 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) { // 触发检查更新(此方法用于被渲染线程调用,例如页面点击检查更新按钮来调用此方法) ipcMain.handle('check-for-update', async () => { - autoUpdater.logger?.info('触发检查更新') return { currentVersion: autoUpdater.currentVersion, update: await autoUpdater.checkForUpdates() diff --git a/src/main/updater.ts b/src/main/updater.ts index 07b24328..e6c4d80b 100644 --- a/src/main/updater.ts +++ b/src/main/updater.ts @@ -17,11 +17,6 @@ export default class AppUpdater { mainWindow.webContents.send('update-error', error) }) - // 检测是否需要更新 - autoUpdater.on('checking-for-update', () => { - logger.info('正在检查更新……') - }) - autoUpdater.on('update-available', (releaseInfo: UpdateInfo) => { autoUpdater.logger?.info('检测到新版本,确认是否下载') mainWindow.webContents.send('update-available', releaseInfo) @@ -59,7 +54,6 @@ export default class AppUpdater { // 检测到不需要更新时 autoUpdater.on('update-not-available', () => { - logger.info('现在使用的就是最新版本,不用更新') mainWindow.webContents.send('update-not-available') }) diff --git a/src/main/utils/upgrade.ts b/src/main/utils/upgrade.ts index d9de5eda..f876ede8 100644 --- a/src/main/utils/upgrade.ts +++ b/src/main/utils/upgrade.ts @@ -9,7 +9,7 @@ export async function updateUserDataPath() { const oldPath = currentPath.replace('CherryStudio', 'cherry-studio') if (fs.existsSync(oldPath)) { - Logger.log('更新 userData 路径') + Logger.log('Update userData path') try { if (process.platform === 'win32') { @@ -20,15 +20,15 @@ export async function updateUserDataPath() { // 其他系统:直接更新 fs.rmSync(currentPath, { recursive: true, force: true }) fs.renameSync(oldPath, currentPath) - Logger.log(`目录已重命名: ${currentPath}`) + Logger.log(`Directory renamed: ${currentPath}`) await promptRestart() } } catch (error: any) { - Logger.error('更新 userData 路径时出错:', error) + Logger.error('Error updating userData path:', error) dialog.showErrorBox('错误', `更新用户数据目录时发生错误: ${error.message}`) } } else { - Logger.log('userData 路径不需要更新') + Logger.log('userData path does not need to be updated') } }