Skip to content

Instantly share code, notes, and snippets.

@J2TEAM
Created March 21, 2019 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save J2TEAM/79aea6a7e61c002e0b3e73879994dce1 to your computer and use it in GitHub Desktop.
Save J2TEAM/79aea6a7e61c002e0b3e73879994dce1 to your computer and use it in GitHub Desktop.
Auto disable console.log() on production
const DEBUG = false;
if (!DEBUG) {
if (!window.console) window.console = {};
let methods = ['log', 'debug', 'warn', 'info'];
for (let i = 0; i < methods.length; i++) {
console[methods[i]] = function() {};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment