flatiron/winston — pull request #447 by compulim (2014-09-11 04:27:56+00:00)
Title: Flush buffer again after first "flush" event

In file transport, before the `FileStream` is opened, logs are buffered to `_buffer`.

Once the `FileStream` is opened, file transport will flush `_buffer` to disk and wait for the first `drain` event from the stream. After the `drain` event is received, `_buffer` will be decommissioned and subsequent write will direct to the `FileStream` itself.

There are race condition when the logs are written inbetween the `flush` call, and the `drain` event. Logs written inbetween them will be stored in `_buffer`. But because we did not flush the `_buffer` again after `drain`, some logs could be orphaned there forever.

The fix is to flush the `_buffer` again after the `drain` event is received.