Skip to content

Instantly share code, notes, and snippets.

@kmonsoor
Last active May 29, 2018 17:02
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 kmonsoor/0244fdb4ad79a4826371e58a1a5fa984 to your computer and use it in GitHub Desktop.
Save kmonsoor/0244fdb4ad79a4826371e58a1a5fa984 to your computer and use it in GitHub Desktop.
JavaScript -- Disable console.log & other in-browser console.* methods
"use strict";
(() => {
var console = (window.console = window.console || {});
[
"assert", "clear", "count", "debug", "dir", "dirxml",
"error", "exception", "group", "groupCollapsed", "groupEnd",
"info", "log", "markTimeline", "profile", "profileEnd", "table",
"time", "timeEnd", "timeStamp", "trace", "warn"
].forEach(method => {
console[method] = () => {};
});
console.log("This message shouldn't be visible in console log");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment