console-monkey-patch
Hack the console object methods (like log, error, info etc.).
Abstract
In Node.js it is sometime desirable to redirect console.log
& Co. calls to a
given stream but not possible to actually replace stdout
and/or stderr
.
This module allow to override console
methods in a simple way.
Installation
npm install console-monkey-patch
Simple example
The most simple example is to create a new console.Console
object (see
https://nodejs.org/api/console.html#console_class_console):
var fs = ;var newstdout = fs;var newstderr = fs;var newcons = newstdout newstderr; newcons; console;console;
Limitations
The module only override the console
methods documented at
https://nodejs.org/api/console.html and does not replace process.stdout
and
process.stderr
. As a result, code (including modules) using directly theses
streams won't be "affected".
LICENSE
MIT, see MIT-LICENSE.