namshi / winston-graylog2

Graylog2 transport for winston, a nodejs logging module
MIT License
126 stars 98 forks source link

Close Graylog2 connection on close. Fixes #24 #50

Closed YoniPrv closed 7 years ago

YoniPrv commented 7 years ago

Fix an issue where the Graylog2 transport ignores requests from Winston to close the transport. This causes applications depending on Winston's close() functionality to hang.

Winston has a feature where transports can support the .close() call, which is called when a program calls .close() on the Winston logger instance. Transports can use this method to release their resources and shut down gracefully.

This pull request uses this feature to close the Graylog2 connection when Winston is cleaning up.

Caveat: currently there is no way to pass Graylog2's close() callback to Winston, since Winston does not support this.

odino commented 7 years ago

Hi @YoniPrv, thanks for the PR! I just merged and published on NPM in v0.7.0!

YoniPrv commented 7 years ago

Thanks for merging!