Created
November 12, 2012 13:07
-
-
Save mcs/4059304 to your computer and use it in GitHub Desktop.
Log wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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