Fix logger

This commit is contained in:
Tamius Han 2019-11-04 22:14:41 +01:00
parent 5f4abcec1f
commit 08460a923d

View File

@ -120,27 +120,29 @@ class Logger {
if (!this.conf.fileOptions.enabled || this.temp_disable) { if (!this.conf.fileOptions.enabled || this.temp_disable) {
return false; return false;
} }
if (component.length ) { if (Array.isArray(component) && component.length ) {
for (const c in component) { for (const c of component) {
if (this.conf.fileOptions[component]) { if (this.conf.fileOptions[c]) {
return this.conf.fileOptions[component]; return this.conf.fileOptions[c];
} }
} }
} } else {
return this.conf.fileOptions[component]; return this.conf.fileOptions[component];
}
} }
canLogConsole(component) { canLogConsole(component) {
if (!this.conf.consoleOptions.enabled || this.temp_disable) { if (!this.conf.consoleOptions.enabled || this.temp_disable) {
return false; return false;
} }
if (Array.isArray(component) && component.length) { if (Array.isArray(component) && component.length) {
for (const c in component) { for (const c of component) {
if (this.conf.consoleOptions[component]) { if (this.conf.consoleOptions[c]) {
return this.conf.consoleOptions[component]; return this.conf.consoleOptions[c];
} }
} }
} } else {
return this.conf.consoleOptions[component]; return this.conf.consoleOptions[component];
}
} }
// level is unused as of now, but this may change in the future // level is unused as of now, but this may change in the future