Created
May 30, 2022 19:03
-
-
Save DavesCodeMusings/0e0e89a04b64453d27350e14edfb1470 to your computer and use it in GitHub Desktop.
Suppress showing of debug messages by replacing console.debug() with a custom function that checks a 'debug' flag before logging.
This file contains hidden or 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
| #!/usr/bin/env node | |
| let _console_debug = console.debug | |
| console.debug = function(message) { | |
| if (debug) { | |
| _console_debug.apply(console, arguments) | |
| } | |
| } | |
| let debug = true | |
| console.debug("This should be shown.") | |
| debug = false | |
| console.debug("This should be suppressed.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment