From aae505ad68a072132e8e149115d227d6e2505a8a Mon Sep 17 00:00:00 2001 From: naskya Date: Sat, 27 Apr 2024 05:48:56 +0900 Subject: [PATCH] fix (backend): correctly fallback maxLogLevel to info --- packages/backend/src/services/logger.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index 92fc7c6e79..2f1f552d03 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -47,8 +47,8 @@ export default class Logger { return logger; } - private showThisLog(logLevel: Level, configLevel: string) { - switch (configLevel) { + private showThisLog(logLevel: Level, configMaxLevel: string) { + switch (configMaxLevel) { case "error": return ["error"].includes(logLevel); case "warning": @@ -75,7 +75,10 @@ export default class Logger { if ( (config.maxLogLevel != null && !this.showThisLog(level, config.maxLogLevel)) || - (config.logLevel != null && !config.logLevel.includes(level)) + (config.logLevel != null && !config.logLevel.includes(level)) || + (config.maxLogLevel == null && + config.logLevel == null && + !this.showThisLog(level, "info")) ) return; if (!this.store) store = false;