Created
May 14, 2014 08:11
-
-
Save jspaper/ccff4d06794528bc3df8 to your computer and use it in GitHub Desktop.
logger
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
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