Skip to content

Commit

Permalink
[fix] Partial fix for #296. Need to properly detect _isStreams2 cc/…
Browse files Browse the repository at this point in the history
… @jcruggz.
  • Loading branch information
indexzero committed Nov 4, 2014
1 parent e08e504 commit b0227b6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/winston/transports/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ File.prototype.log = function (level, msg, meta, callback) {
// Write to the stream, ensure execution of a callback on completion.
//
File.prototype._write = function(data, callback) {
if (this._isStreams2) {
this._stream.write(data);
return process.nextTick(function () {
callback(null, true);
});
}

// If this is a file write stream, we could use the builtin
// callback functionality, however, the stream is not guaranteed
// to be an fs.WriteStream.
Expand Down Expand Up @@ -295,11 +302,11 @@ File.prototype.stream = function (options) {
};

stream.destroy = common.tailFile(tail, function (err, line) {

if(err){
return stream.emit('error',err);
}

try {
stream.emit('data', line);
line = JSON.parse(line);
Expand Down

0 comments on commit b0227b6

Please sign in to comment.