Fix logging popup a bit
This commit is contained in:
parent
981da95cde
commit
a234903b8f
@ -276,6 +276,8 @@ export default {
|
|||||||
this.logStringified = undefined;
|
this.logStringified = undefined;
|
||||||
}
|
}
|
||||||
this.$store.dispatch('uw-hide-logger');
|
this.$store.dispatch('uw-hide-logger');
|
||||||
|
|
||||||
|
this.showLoggerUi = false;
|
||||||
},
|
},
|
||||||
closePopupAndStopLogging() {
|
closePopupAndStopLogging() {
|
||||||
Logger.saveConfig({...this.lastSettings, allowLogging: false});
|
Logger.saveConfig({...this.lastSettings, allowLogging: false});
|
||||||
|
@ -314,23 +314,31 @@ class ActionHandler {
|
|||||||
handleKeyup(event) {
|
handleKeyup(event) {
|
||||||
this.logger.log('info', 'keyboard', "%c[ActionHandler::handleKeyup] we pressed a key: ", "color: #ff0", event.key , " | keyup: ", event.keyup, "event:", event);
|
this.logger.log('info', 'keyboard', "%c[ActionHandler::handleKeyup] we pressed a key: ", "color: #ff0", event.key , " | keyup: ", event.keyup, "event:", event);
|
||||||
|
|
||||||
if (this.preventAction(event)) {
|
try {
|
||||||
this.logger.log('info', 'keyboard', "[ActionHandler::handleKeyup] we are in a text box or something. Doing nothing.");
|
if (this.preventAction(event)) {
|
||||||
return;
|
this.logger.log('info', 'keyboard', "[ActionHandler::handleKeyup] we are in a text box or something. Doing nothing.");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.execAction(this.keyUpActions, event);
|
this.execAction(this.keyUpActions, event);
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.log('info', 'debug', '[ActionHandler::handleKeyup] Failed to handle keyup!', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeydown(event) {
|
handleKeydown(event) {
|
||||||
this.logger.log('info', 'keyboard', "%c[ActionHandler::handleKeydown] we pressed a key: ", "color: #ff0", event.key , " | keydown: ", event.keydown, "event:", event)
|
this.logger.log('info', 'keyboard', "%c[ActionHandler::handleKeydown] we pressed a key: ", "color: #ff0", event.key , " | keydown: ", event.keydown, "event:", event)
|
||||||
|
|
||||||
if (this.preventAction(event)) {
|
try {
|
||||||
this.logger.log('info', 'keyboard', "[ActionHandler::handleKeydown] we are in a text box or something. Doing nothing.");
|
if (this.preventAction(event)) {
|
||||||
return;
|
this.logger.log('info', 'keyboard', "[ActionHandler::handleKeydown] we are in a text box or something. Doing nothing.");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.execAction(this.keyDownActions, event);
|
this.execAction(this.keyDownActions, event);
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.log('info', 'debug', '[ActionHandler::handleKeydown] Failed to handle keydown!', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMouseMove(event, videoData?: VideoData) {
|
handleMouseMove(event, videoData?: VideoData) {
|
||||||
|
@ -91,6 +91,10 @@ class Logger {
|
|||||||
constructor(options?: {vuexStore?: any, uwInstance?: any}) {
|
constructor(options?: {vuexStore?: any, uwInstance?: any}) {
|
||||||
this.vuexStore = options?.vuexStore;
|
this.vuexStore = options?.vuexStore;
|
||||||
this.uwInstance = options?.uwInstance;
|
this.uwInstance = options?.uwInstance;
|
||||||
|
|
||||||
|
browser.storage.onChanged.addListener((changes, area) => {
|
||||||
|
this.storageChangeListener(changes, area)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static saveConfig(conf: LoggerConfig) {
|
static saveConfig(conf: LoggerConfig) {
|
||||||
@ -190,6 +194,34 @@ class Logger {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storageChangeListener(changes, area) {
|
||||||
|
if (!changes.uwLogger) {
|
||||||
|
console.info('We dont have any logging settings, not processing frther');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.conf = JSON.parse(changes.uwLogger.newValue);
|
||||||
|
} catch (e) {
|
||||||
|
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
|
||||||
|
// 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
|
||||||
|
// to an action.
|
||||||
|
console.info(
|
||||||
|
'[uwLogger] logger config changed! New configuration:',
|
||||||
|
this.conf, '\nraw changes:', changes, 'area?', area,
|
||||||
|
'\n————————————————————————————————————————————————————————————————————————\n\n\n\n\n\n\n\n\n\n\n\n-----\nLogging with new settings starts now.'
|
||||||
|
);
|
||||||
|
|
||||||
|
// initiate loger if need be
|
||||||
|
if (!this.startTime) {
|
||||||
|
this.init(this.conf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setVuexStore(store) {
|
setVuexStore(store) {
|
||||||
this.vuexStore = store;
|
this.vuexStore = store;
|
||||||
}
|
}
|
||||||
@ -386,7 +418,7 @@ class Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
canLogFile(component) {
|
canLogFile(component) {
|
||||||
if (!this.conf.fileOptions.enabled || this.temp_disable) {
|
if (!this.conf?.fileOptions?.enabled || this.temp_disable) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Array.isArray(component) && component.length ) {
|
if (Array.isArray(component) && component.length ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user