From f56e18c000860c99d40804ea53e642cb15137f8b Mon Sep 17 00:00:00 2001 From: Ashley Nolan Date: Thu, 29 Aug 2013 15:05:10 +0100 Subject: [PATCH] adding in quick log support --- js/helpers/console.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/js/helpers/console.js b/js/helpers/console.js index e8f55427..b015cf78 100644 --- a/js/helpers/console.js +++ b/js/helpers/console.js @@ -13,3 +13,24 @@ } } })(window); + + +// usage: log('inside coolFunc', this, arguments); +// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ +window.log = function f() { + log.history = log.history || []; + log.history.push(arguments); + if (this.console) { + var args = arguments, + newarr; + try { + args.callee = f.caller; + } catch (e) {} + newarr = [].slice.call(args); + if (typeof console.log === 'object') { + log.apply.call(console.log, console, newarr); + } else { + console.log.apply(console, newarr); + } + } +}; \ No newline at end of file