Skip to content

Instantly share code, notes, and snippets.

@jspaper
Created May 14, 2014 08:11
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 jspaper/ccff4d06794528bc3df8 to your computer and use it in GitHub Desktop.
Save jspaper/ccff4d06794528bc3df8 to your computer and use it in GitHub Desktop.
logger
var logger = function () {
var oldDebug = null,
oldLog = null,
oldInfo = null,
oldWarn = null,
oldError = null;
return {
enable: function () {
if (oldLog === null) return;
window.console.debug = oldDebug;
window.console.log = oldLog;
window.console.info = oldInfo;
window.console.warn = oldWarn;
window.console.error = oldError;
},
disable: function () {
oldDebug = console.debug;
oldLog = console.log;
oldInfo = console.info;
oldWarn = console.warn;
oldError = console.error;
window.console.debug = function () {};
window.console.log = function () {};
window.console.info = function () {};
window.console.warn = function () {};
window.console.error = function () {};
}
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment