From 9ab29259b1037d92bae989fd6dbbe19fe357691f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=98=89=E4=BC=9F?= <8473136@qq.com> Date: Wed, 8 Jan 2025 13:53:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Refactor=20logging=20in=20GitHub?= =?UTF-8?q?=20API:=20Replaced=20deprecated=20logging=20with=20a=20new=20lo?= =?UTF-8?q?gging=20utility=20for=20improved=20traceability.=20Updated=20lo?= =?UTF-8?q?g=20statements=20to=20use=20structured=20logging=20for=20mirror?= =?UTF-8?q?=20URL=20requests=20and=20response=20status=20codes,=20enhancin?= =?UTF-8?q?g=20clarity=20and=20consistency=20in=20logs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/api/github.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/electron/api/github.ts b/electron/api/github.ts index 6f00346..8c43465 100644 --- a/electron/api/github.ts +++ b/electron/api/github.ts @@ -10,7 +10,6 @@ const path = require("path"); const zlib = require("zlib"); const { download } = require("electron-dl"); const AdmZip = require("adm-zip"); -const log = require("electron-log"); import frpReleasesJson from "../json/frp-releases.json"; import { logInfo, logError, LogModule, logDebug, logWarn } from "../utils/log"; @@ -259,7 +258,7 @@ export const initGitHubApi = () => { ipcMain.on("github.getFrpVersions", async (event, mirror: string) => { const { api } = conventMirrorUrl(mirror); const mirrorUrl = api; - log.info("Requesting mirror URL: ", mirrorUrl); + logInfo(LogModule.GITHUB, `Requesting mirror URL: ${mirrorUrl}`); const request = net.request({ method: "get", url: `${mirrorUrl}/repos/fatedier/frp/releases?page=1&per_page=1000` @@ -267,7 +266,7 @@ export const initGitHubApi = () => { let githubReleaseJsonStr = null; request.on("response", response => { - log.info("Received response with status code: ", response.statusCode); + logInfo(LogModule.GITHUB, `Received response with status code: ${response.statusCode}`); let responseData: Buffer = Buffer.alloc(0); response.on("data", (data: Buffer) => { responseData = Buffer.concat([responseData, data]);