Skip to content

Instantly share code, notes, and snippets.

@mcs
Created November 12, 2012 13:07
Show Gist options
  • Save mcs/4059304 to your computer and use it in GitHub Desktop.
Save mcs/4059304 to your computer and use it in GitHub Desktop.
Log wrapper
/**
* Creates a log wrapper for browser console. If console.log is defined, it passed the function arguments to it.
* Using this method prevents problems when using console.log directly in IE (at least in version 8).
*/
var logger = function () {
if (console && console.log) {
console.log.call(console, arguments);
}
}
// ...
// later invocation
logger.log("%o", "Hello JavaScript!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment