Created
May 26, 2017 08:19
-
-
Save DerKobe/3c32c77ad16c0fc9088a31cd3bde8bc9 to your computer and use it in GitHub Desktop.
Console log filter hack (because Chrome made a bad decision when removing the selective log filters)
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
// Taken from a post by Wojciech Zieliński at https://groups.google.com/forum/#!topic/google-chrome-developer-tools/kH3FiDLlsFg | |
const consoleDummy = { warn: () => {}, log: () => {}, error: () => {}, info: () => {} }; | |
const { warn, log, error, info } = window.console || consoleDummy; | |
const $flags = { | |
warn: true, | |
log: true, | |
error: true, | |
info: true, | |
}; | |
window.console.warn = (...args) => { $flags.warn && warn(...args) }; | |
window.console.log = (...args) => { $flags.log && log(...args) }; | |
window.console.error = (...args) => { $flags.error && error(...args) }; | |
window.console.info = (...args) => { $flags.info && info(...args) }; | |
window.$setConsoleFilter = (flag, value) => { $flags[flag] = value }; | |
window.$toggleConsoleFilter = (flag) => window.$setConsoleFilter(flag, !$flags[flag]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment