Skip to content

Commit

Permalink
adding in quick log support
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleynolan committed Aug 29, 2013
1 parent c5d80f7 commit f56e18c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions js/helpers/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
};

0 comments on commit f56e18c

Please sign in to comment.