From 2c398a6832dd3a5a1cebf0ee98ad7f3c7a7bf663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 13 Nov 2024 12:29:17 +0800 Subject: [PATCH] fix: error --- package.json | 1 - src/common/log.ts | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 40e429cc..e1cd5e45 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "dependencies": { "express": "^5.0.0", "fluent-ffmpeg": "^2.1.2", - "log4js": "^6.9.1", "qrcode-terminal": "^0.12.0", "silk-wasm": "^3.6.1", "ws": "^8.18.0" diff --git a/src/common/log.ts b/src/common/log.ts index 69ae9afb..159d98d8 100644 --- a/src/common/log.ts +++ b/src/common/log.ts @@ -110,14 +110,15 @@ export class LogWrapper { _log(level: LogLevel, ...args: any[]) { const message = this.formatMsg(args); - if (this.consoleLogEnabled) { + if (this.consoleLogEnabled && this.fileLogEnabled) { this.logger.log(level, message); - } - if (this.fileLogEnabled) { + } else if (this.consoleLogEnabled) { + this.logger.log(level, message); + } else if (this.fileLogEnabled) { this.logger.log(level, message.replace(/\x1B[@-_][0-?]*[ -/]*[@-~]/g, '')); } } - + log(...args: any[]) { this._log(LogLevel.INFO, ...args); }