Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion FileStreamRotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,10 @@ FileStreamRotator.getStream = function (options) {
stream.emit('rotate',oldFile, newLogfile);
BubbleEvents(rotateStream,stream);
}
rotateStream.write(str, encoding);
// should not write when rotateStream has been destroyed, avoiding this case: https://github.com/winstonjs/winston-daily-rotate-file/issues/226
if(!rotateStream.destroyed) {
rotateStream.write(str, encoding);
}
// Handle length of double-byte characters
curSize += Buffer.byteLength(str, encoding);
}).bind(this);
Expand Down