Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Allow stream used by console to be selected by process._console_selec…
Browse files Browse the repository at this point in the history
…tor.

Existing behaviour is preserved unless --console-to-stderr has been specified
on the command line.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
  • Loading branch information
jonseymour committed Apr 21, 2011
1 parent 0b3ecc0 commit f5fd098
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/console.js
Expand Up @@ -56,12 +56,16 @@ function format(f) {
return str;
}


exports.log = function() {
process.stdout.write(format.apply(this, arguments) + '\n');
if (!process._console_selector) {
exports.log = function() {
process.stdout.write(format.apply(this, arguments) + '\n');
};
} else {
exports.log = function() {
process[process._console_selector].write(format.apply(this, arguments) + '\n');
};
};


exports.info = exports.log;


Expand Down

0 comments on commit f5fd098

Please sign in to comment.