fix (backend): correctly fallback maxLogLevel to info

This commit is contained in:
naskya 2024-04-27 05:48:56 +09:00
parent f80ee9f36d
commit aae505ad68
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -47,8 +47,8 @@ export default class Logger {
return logger; return logger;
} }
private showThisLog(logLevel: Level, configLevel: string) { private showThisLog(logLevel: Level, configMaxLevel: string) {
switch (configLevel) { switch (configMaxLevel) {
case "error": case "error":
return ["error"].includes(logLevel); return ["error"].includes(logLevel);
case "warning": case "warning":
@ -75,7 +75,10 @@ export default class Logger {
if ( if (
(config.maxLogLevel != null && (config.maxLogLevel != null &&
!this.showThisLog(level, config.maxLogLevel)) || !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; return;
if (!this.store) store = false; if (!this.store) store = false;