Last active
August 29, 2015 14:17
-
-
Save ramnathv/ea8f5a614703b833880e 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
// Debug on localhost | |
var host = window.location.hostname; | |
var debug = host.match(/localhost|127.0.0.1|staging.example.com/); | |
// Safely log things, if need be | |
function log() { | |
if (debug && console && typeof console.log === 'function') { | |
for (var i = 0, ii = arguments.length; i < ii; i++) { | |
console.log(arguments[i]); | |
} | |
} | |
} | |
// This will do nothing, in production | |
log('Testing, testing...'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment