From 355108e0efd758a101edac20562e9a467f7d588c Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 6 Feb 2020 23:53:31 +0100 Subject: [PATCH] Ensure things don't crash on undefined settings --- src/ext/lib/Logger.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ext/lib/Logger.js b/src/ext/lib/Logger.js index 61a09a1..32157fa 100644 --- a/src/ext/lib/Logger.js +++ b/src/ext/lib/Logger.js @@ -1,6 +1,5 @@ import currentBrowser from '../conf/BrowserDetect'; import { decycle } from 'json-cyclic'; -import { sleep } from '../../common/js/utils'; class Logger { constructor(options) { @@ -376,10 +375,10 @@ class Logger { // skip all checks if we force log if (level === 'force') { - if (this.conf.fileOptions.enabled) { + if (this.conf.fileOptions?.enabled) { this.logToFile(message, stackInfo); } - if (this.conf.consoleOptions.enabled) { + if (this.conf.consoleOptions?.enabled) { this.logToConsole(message, stackInfo); } return; // don't check further — recursion-land ahead! @@ -394,12 +393,12 @@ class Logger { return; } - if (this.conf.fileOptions.enabled) { + if (this.conf.fileOptions?.enabled) { if (this.canLogFile(component) || stackInfo.exitLogs) { this.logToFile(message, stackInfo); } } - if (this.conf.consoleOptions.enabled) { + if (this.conf.consoleOptions?.enabled) { if (this.canLogConsole(component) || stackInfo.exitLogs) { this.logToConsole(message, stackInfo); }