Fix saving logs
This commit is contained in:
parent
783684570c
commit
06a2f67759
@ -202,7 +202,7 @@ class Logger {
|
||||
// } else {
|
||||
// this.exportLogToFile();
|
||||
}
|
||||
this.saveToVuex();
|
||||
this.saveViaBgScript();
|
||||
}
|
||||
|
||||
parseStack() {
|
||||
@ -475,6 +475,34 @@ class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
saveViaBgScript() {
|
||||
console.info('[info] will attempt to save. Issuing "show-logger"');
|
||||
if (!this.conf?.fileOptions?.enabled || this.isBackgroundScript) {
|
||||
console.info('[info] Logging to file is either disabled or we\'re not on the content script. Not saving.');
|
||||
return;
|
||||
}
|
||||
|
||||
Comms.sendMessage({cmd: 'show-logger', forwardToSameFramePort: true, port: 'content-ui-port'});
|
||||
|
||||
let exportObject;
|
||||
try {
|
||||
exportObject = {
|
||||
pageLogs: decycle(this.history),
|
||||
backgroundLogs: decycle(this.globalHistory),
|
||||
loggerFileOptions: this.conf.fileOptions,
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("[fail] error parsing logs!", e)
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Comms.sendMessage({cmd: 'emit-logs', payload: JSON.stringify(exportObject), forwardToSameFramePort: true, port: 'content-ui-port'})
|
||||
} catch (e) {
|
||||
console.log("failed to send message")
|
||||
}
|
||||
}
|
||||
|
||||
saveToVuex() {
|
||||
console.info('[info] will attempt to save to vuex store.');
|
||||
if (!this.conf?.fileOptions?.enabled || this.isBackgroundScript) {
|
||||
|
Loading…
Reference in New Issue
Block a user