From 7380665cc223bc9411a279fbb621e221cbefc4f1 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: Fri, 6 Mar 2026 10:48:03 +0800 Subject: [PATCH] Notify log subscription only when logger exists Move logSubscription.notify into the branch that calls this.logger.log and remove the previous external call. This ensures the subscription is notified only when the configured logger is used, avoiding redundant or spurious notifications. --- packages/napcat-core/helper/log.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/napcat-core/helper/log.ts b/packages/napcat-core/helper/log.ts index 722bcf554..25cea529b 100644 --- a/packages/napcat-core/helper/log.ts +++ b/packages/napcat-core/helper/log.ts @@ -196,8 +196,8 @@ export class LogWrapper implements ILogWrapper { // eslint-disable-next-line no-control-regex this.logger.log(level, message.replace(/\x1B[@-_][0-?]*[ -/]*[@-~]/g, '')); } + logSubscription.notify(JSON.stringify({ level, message })); } - logSubscription.notify(JSON.stringify({ level, message })); } log (...args: any[]) {