juankennaugh
6/4/2013 - 1:49 PM

log.js

// 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...');