pinojs / pino-socket

🌲 A transport for sending pino logs to network sockets
43 stars 14 forks source link

resolves #73 emit open when reconnect and emit socketError instead of error #78

Closed ggrossetie closed 2 years ago

ggrossetie commented 2 years ago

Follow-up of #76

I will rebase on master once #76 is merged and add a unit test to make sure that open is emitted on reconnect and that socketError is emitted when an error occurs on the TCP or UDP socket.

This is potentially a breaking change since previously the UDP socket emitted an error event. The new behavior is more friendly since it won't close/end the stream. Please note that it's still possible to obtain the previous behavior using:

stream.on('socketError', (err) => stream.destroy(err))
// or
stream.on('socketError', (err) => stream.emit('error', err))
ggrossetie commented 2 years ago

Rebased and tests added