Created
May 12, 2014 14:15
-
-
Save codyromano/94cd8c25d1cec1e45c16 to your computer and use it in GitHub Desktop.
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
/** | |
* An alias for console.log. Only logs messages if the browser | |
* supports 'console' and the script is running in a dev environment. | |
* | |
* @param {Mixed} Any number of arguments | |
* @return {Undefined} | |
*/ | |
var safeLog = (function(){ | |
var url = window.location.href, | |
logAllowed = url.indexOf('8888') > -1 && window.console; | |
return function(){ | |
if (logAllowed) console.log.apply(console, arguments); | |
}; | |
})(); | |
// E.g. | |
safeLog('mytest', {test: 'testing'}, ['another', 'test']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment