Skip to content

Instantly share code, notes, and snippets.

@octaharon
Created June 10, 2018 09:35
Show Gist options
  • Save octaharon/79564c0389c01a863ca47bfc6f91fcab to your computer and use it in GitHub Desktop.
Save octaharon/79564c0389c01a863ca47bfc6f91fcab to your computer and use it in GitHub Desktop.
Intercept/override/disable console calls
const consoleOverride = {
'log': options.debug && options.verbose,
'debug': options.debug,
'info': options.verbose
}
Object.keys(consoleOverride).forEach(cmd => {
let oldMethod = console[cmd].bind(console);
console[cmd] = function (...args) {
if (consoleOverride[cmd])
return oldMethod.apply(
console,
args
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment