From 8c73056693caec6f9e97705e3dbc6205332b50b9 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Wed, 21 Aug 2019 16:06:32 +0300 Subject: [PATCH] Tweak rageshake logging messages Signed-off-by: Jason Robinson --- src/rageshake/rageshake.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rageshake/rageshake.js b/src/rageshake/rageshake.js index 6366392c04..87c98d105a 100644 --- a/src/rageshake/rageshake.js +++ b/src/rageshake/rageshake.js @@ -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