Improve logging of storage listener in logger

This commit is contained in:
Tamius Han 2020-02-09 01:14:05 +01:00
parent f53faac344
commit a5685fa420

View File

@ -99,12 +99,18 @@ class Logger {
br.storage.onChanged.addListener( (changes, area) => {
if (process.env.CHANNEL === 'dev') {
console.log("[Logger::<storage/on change>] Settings have been changed outside of here. Updating active settings. Changes:", changes, "storage area:", area);
if (changes['uwLogger'] && changes['uwLogger'].newValue) {
console.log("[Logger::<storage/on change>] new settings object:", JSON.parse(changes.uwLogger.newValue));
}
if (!changes.uwLogger) {
console.info('[Logger::<storage/on change> No new logger settings!');
}
if (changes['uwLogger'] && changes['uwLogger'].newValue) {
console.log("[Logger::<storage/on change>] Logger have been changed outside of here. Updating active settings. Changes:", changes, "storage area:", area);
console.info("[Logger::<storage/on change>] new logger settings object (parsed):", JSON.parse(changes.uwLogger.newValue));
}
}
if (!changes['uwLogger']) {
return;
}
if (changes['uwLogger']?.newValue) {
const newConf = JSON.parse(changes.uwLogger.newValue);
if (this.isContentScript && this.conf.allowLogging && !newConf.allowLogging) {
this.saveToVuex();