From 627acdbfdeae585e449162fa15275df7ea270215 Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Mon, 23 Dec 2013 11:48:39 -0800 Subject: [PATCH] Update in-browser logging to accommodate n-args --- src/js/ripple/utils.web.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/js/ripple/utils.web.js b/src/js/ripple/utils.web.js index b3a49e50..b9ba6444 100644 --- a/src/js/ripple/utils.web.js +++ b/src/js/ripple/utils.web.js @@ -3,9 +3,17 @@ var exports = module.exports = require('./utils.js'); // We override this function for browsers, because they print objects nicer // natively than JSON.stringify can. exports.logObject = function (msg, obj) { - if (/MSIE/.test(navigator.userAgent)) { - console.log(msg, JSON.stringify(obj)); - } else { - console.log(msg, "", obj); - } + var args = Array.prototype.slice.call(arguments, 1); + + args = args.map(function(arg) { + if (/MSIE/.test(navigator.userAgent)) { + return JSON.stringify(arg, null, 2); + } else { + return arg; + } + }); + + args.unshift(msg); + + console.log.apply(console, args); };