Created
July 21, 2010 13:37
-
-
Save abhiomkar/484491 to your computer and use it in GitHub Desktop.
User-defined console.log() function for debug messages in JavaScript. Useful if Firebug is not installed in your browser.
This file contains hidden or 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
| // Author: Abhinay Omkar | |
| if(!window.console){ | |
| var console = { | |
| log: function(msg){ | |
| throw new Error(msg); | |
| } | |
| } | |
| } | |
| // Use It | |
| // If Firebug is installed in your browser the logger of Firebug will be called | |
| // Otherwise, the above user defined function will be called. | |
| console.log("Hello World!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've just written my own log wrapper function that enclosed it in a try/catch.