You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was struggling some time on automatically closing the fluent socket when idling.
I wanted to emit some logs and then let the process to exit. That never happened, because the internal fluent socket was still open.
I could just call the end() function, but that was not an option for me.
After studying Node.js socket documentation I found out that calling socket.setTimeout doesn't really close the connection, only emits a timeout event which then needs to be handled by the developer.
That was of course my lack of knowledge, but I'm thinking how fluent-logger-node could be improved here.
What do you guys think of emitting the timeout event on the FluentSender and let developer call end() method later?
The other option would be adding e.g. autoClose or closeOnTimeout boolean flags to the FluentSender constructor.
Also I figured that in tls mode, the given timeout is not set on the socket (even { tlsOptions: { timeout: 3 } } doesn't work).
// This will close the logger and its internal socket as soon as possible.logger.end();// This will close the logger and its internal socket after send the last message.logger.end("end","The last message");
Hi guys!
I was struggling some time on automatically closing the
fluent
socket when idling.I wanted to emit some logs and then let the process to exit. That never happened, because the internal
fluent
socket was still open.I could just call the
end()
function, but that was not an option for me.After studying Node.js socket documentation I found out that calling
socket.setTimeout
doesn't really close the connection, only emits atimeout
event which then needs to be handled by the developer.That was of course my lack of knowledge, but I'm thinking how
fluent-logger-node
could be improved here.What do you guys think of emitting the
timeout
event on theFluentSender
and let developer callend()
method later?The other option would be adding e.g.
autoClose
orcloseOnTimeout
boolean flags to theFluentSender
constructor.Also I figured that in
tls
mode, the giventimeout
is not set on thesocket
(even{ tlsOptions: { timeout: 3 } }
doesn't work).For now I use a workaround:
Thanks for feedback. Sorry if I misunderstood the problem and there is some other way to handle that.
The text was updated successfully, but these errors were encountered: