Created
November 5, 2015 12:12
-
-
Save kaworu/89e30265b9a6ca8f526d to your computer and use it in GitHub Desktop.
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
var fs = require("fs"); | |
var dest = "./test.log"; | |
var stream = fs.createWriteStream(dest, {flags: 'a'}); | |
var newcons = new console.Console(stream, stream); | |
// all the stuff documented at https://nodejs.org/api/console.html | |
[ | |
'log', 'info', 'error', 'warn', 'dir', | |
'time', 'timeEnd', 'trace', 'assert' | |
].forEach(function (n) { | |
console[n] = newcons[n]; | |
}); | |
console.log("OHAI"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment