From b60d3d0b975cd077e2f1beeba07a8a4f53ad2512 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 16 Sep 2015 11:09:16 -0700 Subject: [PATCH] Make debug log handle multiple arguments Ex: console.log('delivery receipt', phone_number, timestamp) // FREEBIE --- js/debugLog.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/debugLog.js b/js/debugLog.js index 53bf23ebb..53b9a27f0 100644 --- a/js/debugLog.js +++ b/js/debugLog.js @@ -8,12 +8,13 @@ var debugLog = []; if (window.console) { console._log = console.log; - console.log = function(thing){ - console._log(thing); + console.log = function(){ + console._log.apply(this, arguments); if (debugLog.length > MAX_MESSAGES) { debugLog.shift(); } - var str = ('' + thing).replace(PHONE_REGEX, "+[REDACTED]$1"); + var args = Array.prototype.slice.call(arguments); + var str = args.join(' ').replace(PHONE_REGEX, "+[REDACTED]$1"); debugLog.push(str); }; console.get = function() {