Skip to content

Commit

Permalink
dont close over sink with error printer
Browse files Browse the repository at this point in the history
  • Loading branch information
keis committed Sep 12, 2014
1 parent a54d69f commit 316636d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/sinks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
var fs = require('fs');

// Last resort error printing for when everything fails
function printError(err) {
process.stderr.write('log stream error ' + err + '\n');
}

// # Formatter

// Create a formatter function from pattern string
Expand Down Expand Up @@ -97,9 +102,7 @@ exports.file = function file(options) {
this.stream.end();
}
this.stream = fs.createWriteStream(path, streamOptions)
this.stream.on('error', function (err) {
process.stderr.write('log stream error ' + err + '\n');
});
this.stream.on('error', printError);
};
// reset the file stream immediately to open the first stream
sink.reset();
Expand Down

0 comments on commit 316636d

Please sign in to comment.