Tweak rageshake logging messages

Signed-off-by: Jason Robinson <jasonr@matrix.org>
pull/21833/head
Jason Robinson 2019-08-21 16:06:32 +03:00
parent 0e973bf211
commit 8c73056693
1 changed files with 7 additions and 3 deletions

View File

@ -74,13 +74,17 @@ class ConsoleLogger {
// Convert objects and errors to helpful things
args = args.map((arg) => {
let msg = '';
if (arg instanceof Error) {
return arg.message + (arg.stack ? `\n${arg.stack}` : '');
msg = arg.message + (arg.stack ? `\n${arg.stack}` : '');
} else if (typeof(arg) === 'object') {
return JSON.stringify(arg);
msg = JSON.stringify(arg);
} else {
return arg;
msg = arg;
}
// Do some cleanup
msg = msg.replace(/token=[a-zA-Z0-9-]+/gm, 'token=xxxxx');
return msg;
});
// Some browsers support string formatting which we're not doing here