Auto-show logger popup is logging to file is enabled

This commit is contained in:
Tamius Han 2020-03-13 00:29:19 +01:00
parent f0cc710621
commit 72a3bba8ad

View File

@ -1,8 +1,9 @@
import Debug from './conf/Debug'; import Debug from './conf/Debug';
import BrowserDetect from './conf/BrowserDetect'; import BrowserDetect from './conf/BrowserDetect';
import ExtensionMode from '../common/enums/extension-mode.enum' import ExtensionMode from '../common/enums/extension-mode.enum';
import Settings from './lib/Settings'; import Settings from './lib/Settings';
import ActionHandler from './lib/ActionHandler'; import ActionHandler from './lib/ActionHandler';
import Comms from './lib/comms/Comms';
import CommsClient from './lib/comms/CommsClient'; import CommsClient from './lib/comms/CommsClient';
import PageInfo from './lib/video-data/PageInfo'; import PageInfo from './lib/video-data/PageInfo';
import Logger from './lib/Logger'; import Logger from './lib/Logger';
@ -111,18 +112,12 @@ class UW {
this.logger = new Logger(); this.logger = new Logger();
await this.logger.init(loggingOptions); await this.logger.init(loggingOptions);
if (this.logger.isLoggingAllowed()) {
console.info("[uw::init] Logging is allowed! Initalizing vue and UI!");
}
// show popup if logging to file is enabled // show popup if logging to file is enabled
if (this.logger.isLoggingToFile()) { if (this.logger.isLoggingAllowed() && this.logger.isLoggingToFile()) {
console.info('[uw::init] Logging to file is enabled. Will show popup!'); console.info("[uw::init] Logging is allowed! Initalizing vue and UI!");
try {
this.vuexStore.dispatch('uw-show-logger'); // CommsClient is not initiated yet, so we use static comms to send the command
} catch (e) { Comms.sendMessage({cmd: 'show-logger'});
console.error('[uw::init] Failed to open popup!', e)
}
} }
} }
} catch (e) { } catch (e) {