Debug log optimizations and improvements

This commit is contained in:
Scott Nonnenberg 2019-02-19 15:15:43 -08:00
parent 9afea3ae2b
commit 3fb6ab295f
4 changed files with 6 additions and 6 deletions

View file

@ -3,6 +3,7 @@ const electron = require('electron');
const Errors = require('../js/modules/types/errors');
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
// 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) {
clipboard.writeText(`${prefix}\n${error.stack}`);
clipboard.writeText(`${prefix}\n${redactAll(error.stack)}`);
}
} else {
dialog.showErrorBox(prefix, error.stack);

View file

@ -12,6 +12,8 @@ const readFirstLine = require('firstline');
const readLastLines = require('read-last-lines').read;
const rimraf = require('rimraf');
const { redactAll } = require('../js/modules/privacy');
const { app, ipcMain: ipc } = electron;
const LEVELS = ['fatal', 'error', 'warn', 'info', 'debug', 'trace'];
let logger;
@ -247,7 +249,7 @@ function logAtLevel(level, ...args) {
return item;
});
logger[level](str.join(' '));
logger[level](redactAll(str.join(' ')));
} else {
console._log(...args);
}

View file

@ -1204,7 +1204,6 @@ function createTempDir() {
}
function deleteAll(pattern) {
window.log.info(`Deleting ${pattern}`);
return pify(rimraf)(pattern);
}

View file

@ -588,9 +588,7 @@ MessageReceiver.prototype.extend({
return promise.catch(error => {
window.log.error(
'queueDecryptedEnvelope error handling envelope',
id,
':',
`queueDecryptedEnvelope error handling envelope ${id}:`,
error && error.stack ? error.stack : error
);
});