Skip to content

Commit

Permalink
Flush buffer again after first "flush" event
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Sep 11, 2014
1 parent b534647 commit 0c28041
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/winston/transports/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ File.prototype._createStream = function () {
// and thus can emit the `open` event.
//
self.once('flush', function () {
// Because "flush" event is based on native stream "drain" event,
// logs could be written inbetween "self.flush()" and here
// Therefore, we need to flush again to make sure everything is flushed
self.flush();

self.opening = false;
self.emit('open', fullname);
});
Expand Down

1 comment on commit 0c28041

@logysis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix this in daily-rotate-file.js.

self.once('flush', function () {
  self.opening = false;
  self.emit('open', fullname);
});

thank you

Please sign in to comment.