Node.js module monkeypatching the console object
npm install console-monkey-patch
console.log & Co. calls to astdout and/or stderr.console methods in a simple way.console.Console object (seejavascript
var fs = require("fs");
var newstdout = fs.createWriteStream('/tmp/stdout.log', {flags: 'a'});
var newstderr = fs.createWriteStream('/tmp/stderr.log', {flags: 'a'});
var newcons = new console.Console(newstdout, newstderr);require("console-monkey-patch")(newcons);
console.log('this should go to /tmp/stdout.log');
console.error('this should go to /tmp/stderr.log');
`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