From 99bc940e42e010bb4f049749abab970a87279591 Mon Sep 17 00:00:00 2001 From: td-tomasz-joniec Date: Wed, 26 Apr 2023 13:55:15 +0200 Subject: [PATCH] move guard higher and add comment --- lib/winston/transports/file.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/winston/transports/file.js b/lib/winston/transports/file.js index c9ec1d6dc..49edd8b13 100644 --- a/lib/winston/transports/file.js +++ b/lib/winston/transports/file.js @@ -155,11 +155,13 @@ module.exports = class File extends TransportStream { debug('logged %s %s', this._size, output); this.emit('logged', info); - // Do not attempt to rotate files while opening - if (this._opening) { + // Do not attempt to rotate files while rotating + if (this._rotate) { return; } - if (this._rotate) { + + // Do not attempt to rotate files while opening + if (this._opening) { return; }