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;
}
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;