Created
May 12, 2014 04:20
-
-
Save jackbrown/072ad21d03566e75271c to your computer and use it in GitHub Desktop.
A simple web console wrapper
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
/** | |
* A simple wrapper for the window.console object | |
* | |
* TODO: allow string substitutions: https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions | |
*/ | |
var loggy = (function () { | |
var debug = true; | |
this.info = function(msg){ | |
if(debug && window.console && window.console.info){ | |
console.info(msg); | |
} | |
} | |
this.error = function(msg){ | |
if(debug && window.console && window.console.error){ | |
console.error(msg); | |
} | |
} | |
this.log = function(msg){ | |
if(debug && window.console && window.console.log){ | |
console.log(msg); | |
} | |
} | |
this.warn = function(msg){ | |
if(debug && window.console && window.console.warn){ | |
console.warn(msg); | |
} | |
} | |
return this; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment