🔊 Improve the log

This commit is contained in:
刘嘉伟 2025-01-08 12:05:15 +08:00
parent cfba180603
commit fcb01e83b2
3 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import {ipcMain} from "electron";
import { logDebug, logError, logInfo, LogModule, logWarn } from "electron/utils/log";
import { logDebug, logError, logInfo, LogModule, logWarn } from "../utils/log";
const {exec, spawn} = require("child_process");

View File

@ -23,7 +23,7 @@ import { initFileApi } from "../api/file";
import { getConfig } from "../storage/config";
import { initCommonApi } from "../api/common";
import { initLocalApi } from "../api/local";
import { logError, logInfo, LogModule } from "../utils/log";
import { initLog, logError, logInfo, LogModule } from "../utils/log";
import { maskSensitiveData } from "../utils/desensitize";
process.env.DIST_ELECTRON = join(__dirname, "..");
@ -155,6 +155,7 @@ export const createTray = (config: FrpConfig) => {
logInfo(LogModule.APP, `Tray created successfully.`);
};
app.whenReady().then(() => {
initLog();
logInfo(
LogModule.APP,
`Application started. Current system architecture: ${

View File

@ -5,12 +5,13 @@ export enum LogModule {
FRP_CLIENT = "frpc client",
LOGGER = "logger",
GITHUB = "github",
STORAGE = "",
STORAGE = ""
}
// 设置日志级别
log.transports.file.level = "debug"; // 可以根据需要调整日志级别
log.transports.console.level = "debug"; // 控制台输出日志级别
export const initLog = () => {
log.transports.file.level = "debug";
log.transports.console.level = "debug";
};
// 自定义日志输出函数,记录到指定业务模块
export const logInfo = (module: LogModule, message: string) => {