From 08460a923d6b9d6dbfeee0792b13a4cf9fb5c4cd Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Mon, 4 Nov 2019 22:14:41 +0100 Subject: [PATCH] Fix logger --- src/ext/lib/Logger.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ext/lib/Logger.js b/src/ext/lib/Logger.js index 104e4a0..ed009d9 100644 --- a/src/ext/lib/Logger.js +++ b/src/ext/lib/Logger.js @@ -120,27 +120,29 @@ class Logger { if (!this.conf.fileOptions.enabled || this.temp_disable) { return false; } - if (component.length ) { - for (const c in component) { - if (this.conf.fileOptions[component]) { - return this.conf.fileOptions[component]; + if (Array.isArray(component) && component.length ) { + for (const c of component) { + if (this.conf.fileOptions[c]) { + return this.conf.fileOptions[c]; } } - } - return this.conf.fileOptions[component]; + } else { + return this.conf.fileOptions[component]; + } } canLogConsole(component) { if (!this.conf.consoleOptions.enabled || this.temp_disable) { return false; } if (Array.isArray(component) && component.length) { - for (const c in component) { - if (this.conf.consoleOptions[component]) { - return this.conf.consoleOptions[component]; + for (const c of component) { + if (this.conf.consoleOptions[c]) { + return this.conf.consoleOptions[c]; } } - } - return this.conf.consoleOptions[component]; + } else { + return this.conf.consoleOptions[component]; + } } // level is unused as of now, but this may change in the future