Debug log optimizations and improvements
This commit is contained in:
parent
9afea3ae2b
commit
3fb6ab295f
4 changed files with 6 additions and 6 deletions
|
@ -3,6 +3,7 @@ const electron = require('electron');
|
||||||
const Errors = require('../js/modules/types/errors');
|
const Errors = require('../js/modules/types/errors');
|
||||||
|
|
||||||
const { app, dialog, clipboard } = electron;
|
const { app, dialog, clipboard } = electron;
|
||||||
|
const { redactAll } = require('../js/modules/privacy');
|
||||||
|
|
||||||
// We're using hard-coded strings in this file because it needs to be ready
|
// We're using hard-coded strings in this file because it needs to be ready
|
||||||
// to report errors before we do anything in the app. Also, we expect users to directly
|
// to report errors before we do anything in the app. Also, we expect users to directly
|
||||||
|
@ -23,7 +24,7 @@ function handleError(prefix, error) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (buttonIndex === 1) {
|
if (buttonIndex === 1) {
|
||||||
clipboard.writeText(`${prefix}\n${error.stack}`);
|
clipboard.writeText(`${prefix}\n${redactAll(error.stack)}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dialog.showErrorBox(prefix, error.stack);
|
dialog.showErrorBox(prefix, error.stack);
|
||||||
|
|
|
@ -12,6 +12,8 @@ const readFirstLine = require('firstline');
|
||||||
const readLastLines = require('read-last-lines').read;
|
const readLastLines = require('read-last-lines').read;
|
||||||
const rimraf = require('rimraf');
|
const rimraf = require('rimraf');
|
||||||
|
|
||||||
|
const { redactAll } = require('../js/modules/privacy');
|
||||||
|
|
||||||
const { app, ipcMain: ipc } = electron;
|
const { app, ipcMain: ipc } = electron;
|
||||||
const LEVELS = ['fatal', 'error', 'warn', 'info', 'debug', 'trace'];
|
const LEVELS = ['fatal', 'error', 'warn', 'info', 'debug', 'trace'];
|
||||||
let logger;
|
let logger;
|
||||||
|
@ -247,7 +249,7 @@ function logAtLevel(level, ...args) {
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
logger[level](str.join(' '));
|
logger[level](redactAll(str.join(' ')));
|
||||||
} else {
|
} else {
|
||||||
console._log(...args);
|
console._log(...args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1204,7 +1204,6 @@ function createTempDir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteAll(pattern) {
|
function deleteAll(pattern) {
|
||||||
window.log.info(`Deleting ${pattern}`);
|
|
||||||
return pify(rimraf)(pattern);
|
return pify(rimraf)(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -588,9 +588,7 @@ MessageReceiver.prototype.extend({
|
||||||
|
|
||||||
return promise.catch(error => {
|
return promise.catch(error => {
|
||||||
window.log.error(
|
window.log.error(
|
||||||
'queueDecryptedEnvelope error handling envelope',
|
`queueDecryptedEnvelope error handling envelope ${id}:`,
|
||||||
id,
|
|
||||||
':',
|
|
||||||
error && error.stack ? error.stack : error
|
error && error.stack ? error.stack : error
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue