Console
Two blunt instruments for the console: clear it, or silence it. disableConsole replaces console.log with a no-op and only does so when NODE_ENV is production, so a stray debug log cannot leak into a shipped build while your local output stays intact. When you need the output back afterwards use logging's captureConsole, and for anything structured use logger.
Example
import { disableConsole } from '@rtorcato/js-common/console'
// At the entry point of a shipped bundle.
disableConsole() // no-ops console.log, but only when NODE_ENV === 'production'
console.log('debug noise') // silent in prod, still printed locally
Only console.log is replaced — warn and error keep working, because silencing those in
production is how incidents go unnoticed.
Import
import { clearConsole, disableConsole } from '@rtorcato/js-common/console'
Exports
| Name | Summary |
|---|---|
clearConsole | Clears the console. |
disableConsole | Disables console output in production environment. |