Fix default settings

This commit is contained in:
Tamius Han 2021-09-19 21:21:23 +02:00
parent 2ae84bccd8
commit f7eba0974f

View File

@ -28,10 +28,10 @@ export const baseLoggingOptions: LoggerConfig = {
"resizer": true, "resizer": true,
"scaler": true, "scaler": true,
"stretcher": true, "stretcher": true,
// "videoRescan": true, "videoRescan": false,
// "playerRescan": true, "playerRescan": false,
"arDetect": true, "arDetect": true,
"arDetect_verbose": true "arDetect_verbose": false
}, },
allowBlacklistedOrigins: { allowBlacklistedOrigins: {
'periodicPlayerCheck': false, 'periodicPlayerCheck': false,
@ -166,7 +166,7 @@ class Logger {
if (this.conf.fileOptions === undefined) { if (this.conf.fileOptions === undefined) {
this.conf.fileOptions = {}; this.conf.fileOptions = {};
} }
this.startTime = performance.now(); this.startTime = performance.now();
this.temp_disable = false; this.temp_disable = false;
this.stopTime = this.conf.timeout ? performance.now() + (this.conf.timeout * 1000) : undefined; this.stopTime = this.conf.timeout ? performance.now() + (this.conf.timeout * 1000) : undefined;
@ -205,7 +205,7 @@ class Logger {
} catch (e) { } catch (e) {
console.warn('[uwLogger] Error while trying to parse new conf for logger:', e, '\nWe received the following changes:', changes, 'for area:', area); console.warn('[uwLogger] Error while trying to parse new conf for logger:', e, '\nWe received the following changes:', changes, 'for area:', area);
} }
// This code can only execute if user tried to enable or disable logging // This code can only execute if user tried to enable or disable logging
// through the popup. In cases like this, we do not gate the console.log // through the popup. In cases like this, we do not gate the console.log
// behind a check, since we _always_ want to have this feedback in response // behind a check, since we _always_ want to have this feedback in response
@ -225,7 +225,7 @@ class Logger {
setVuexStore(store) { setVuexStore(store) {
this.vuexStore = store; this.vuexStore = store;
} }
clear() { clear() {
this.history = []; this.history = [];
this.startTime = performance.now(); this.startTime = performance.now();
@ -239,12 +239,12 @@ class Logger {
} }
// async getSaved() { // async getSaved() {
// return Logger.getSaved(); // return Logger.getSaved();
// } // }
// allow syncing of start times between bg and page scripts. // allow syncing of start times between bg and page scripts.
// may result in negative times in the log file, but that doesn't // may result in negative times in the log file, but that doesn't
// really matter // really matter
getStartTime() { getStartTime() {
return this.startTime; return this.startTime;
@ -286,7 +286,7 @@ class Logger {
} }
// this should be used mostly in background page instance of logger, btw // this should be used mostly in background page instance of logger, btw
// //
addToGlobalHistory(key, log) { addToGlobalHistory(key, log) {
this.globalHistory[key] = log; this.globalHistory[key] = log;
this.log('info', 'debug', 'Added log for', key, 'to global history. Current history:', this.globalHistory); this.log('info', 'debug', 'Added log for', key, 'to global history. Current history:', this.globalHistory);
@ -358,8 +358,8 @@ class Logger {
stackInfo.stack.trace.splice(i); stackInfo.stack.trace.splice(i);
break; break;
} }
} }
return stackInfo; return stackInfo;
} }
@ -411,7 +411,7 @@ class Logger {
if (this.isBlacklistedOrigin(stackInfo)) { if (this.isBlacklistedOrigin(stackInfo)) {
return false; return false;
} }
// if either of these two is true, we allow logging to happen (forbidden origins were checked above) // if either of these two is true, we allow logging to happen (forbidden origins were checked above)
return (this.canLogFile(component) || this.canLogConsole(component) || stackInfo.exitLogs); return (this.canLogFile(component) || this.canLogConsole(component) || stackInfo.exitLogs);
@ -448,7 +448,7 @@ class Logger {
return this.conf.logAll; return this.conf.logAll;
} }
logToFile(message, stackInfo) { logToFile(message, stackInfo) {
let ts = performance.now(); let ts = performance.now();
if (ts <= this.history[this.history.length - 1]) { if (ts <= this.history[this.history.length - 1]) {
@ -465,16 +465,16 @@ class Logger {
logToConsole(level, message, stackInfo) { logToConsole(level, message, stackInfo) {
try { try {
switch (level) { switch (level) {
case 'error': case 'error':
console.error(...message, {stack: stackInfo}); console.error(...message, {stack: stackInfo});
break; break;
case 'warn': case 'warn':
console.warn(...message, {stack: stackInfo}); console.warn(...message, {stack: stackInfo});
break; break;
case 'info': case 'info':
console.info(...message, {stack: stackInfo}); console.info(...message, {stack: stackInfo});
break; break;
default: default:
console.log(...message, {stack: stackInfo}); console.log(...message, {stack: stackInfo});
} }
} catch (e) { } catch (e) {
@ -512,7 +512,7 @@ class Logger {
if (this.isBlacklistedOrigin(stackInfo)) { if (this.isBlacklistedOrigin(stackInfo)) {
return; return;
} }
if (this.conf.fileOptions?.enabled) { if (this.conf.fileOptions?.enabled) {
if (this.canLogFile(component) || stackInfo.exitLogs) { if (this.canLogFile(component) || stackInfo.exitLogs) {
this.logToFile(message, stackInfo); this.logToFile(message, stackInfo);
@ -545,7 +545,7 @@ class Logger {
message: "-------------------------------------- CAHEN --------------------------------------" message: "-------------------------------------- CAHEN --------------------------------------"
}); });
// find the spot for the half second mark. In this case, we don't really particularly care whether timestamps // find the spot for the half second mark. In this case, we don't really particularly care whether timestamps
// are duped due to cahen warnings // are duped due to cahen warnings
while (this.history[i--].ts > halfSecondMark) {} while (this.history[i--].ts > halfSecondMark) {}
this.history.push({ this.history.push({
@ -593,7 +593,7 @@ class Logger {
Comms.sendMessage({cmd: 'show-logger', forwardToSameFramePort: true, port: 'content-ui-port'}); Comms.sendMessage({cmd: 'show-logger', forwardToSameFramePort: true, port: 'content-ui-port'});
let exportObject; let exportObject;
try { try {
exportObject = { exportObject = {
pageLogs: decycle(this.history), pageLogs: decycle(this.history),
@ -631,7 +631,7 @@ class Logger {
console.info('[info] vuex store present. Parsing logs.'); console.info('[info] vuex store present. Parsing logs.');
let exportObject; let exportObject;
try { try {
exportObject = { exportObject = {
pageLogs: decycle(this.history), pageLogs: decycle(this.history),