Skip to content

Commit

Permalink
Moved the stdout/stderr fallback streams into the methods it self. Re…
Browse files Browse the repository at this point in the history
…solves #21
  • Loading branch information
Ståle Raknes committed Oct 9, 2016
1 parent 553a138 commit a4cfaea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ module.exports = function ( con, options, prefix_metadata ) {
prefix_metadata = prefix_metadata || options.metadata;
}

var stdout = options.stdout || process.stdout;
var stderr = options.stderr || options.stdout || process.stderr;
var stdout = options.stdout;
var stderr = options.stderr || options.stdout;

var dateFormat = options.formatter || defaultDateFormat,
allowedLogFunctions = getAllowedLogFunctions( options.level );
Expand Down Expand Up @@ -144,9 +144,9 @@ module.exports = function ( con, options, prefix_metadata ) {
}

if ( f === "error" || f === "warn" || ( f === "assert" && !args[0] ) ) {
stderr.write( prefix );
( stderr || process.stderr ).write( prefix );
} else if ( f !== "assert" ) {
stdout.write( prefix );
( stdout || process.stdout ).write( prefix );
}

return org.apply( con, args );
Expand Down

0 comments on commit a4cfaea

Please sign in to comment.