I've been having a strange issue with Winston and was looking for some guidance. I am trying to rotate logs by simply closing the file stream using
myTransport.transports.file.opening = true;
myTtransport.transports.file.close();
then opening it back up using
myTransport.transports.file._createStream();
I tried to use
myTransport.transports.file.open();
But that didn't work as expected after looking at the code. My problem is the I get a
events.js:45
throw arguments[1]; // Unhandled 'error' event
^
Error: EBADF, Bad file descriptor
error once the file is closed, renamed, then opened back up again. Here is a link to a video showing the behavior. In file.js (file transport) after createAndFlush (line 229) is done and self.flush (line 255) is returned. The next execution jumps straight to return return self.emit('error', err);
(line 261).
Any help anyone could provide would be greatly appreciated. I've been working on this for a few says now and can't seem to find anything about it on here or any other board. I know winston has maxFile size and maxFiles, but this will not work for our needs. Thanks.
-Steve