Closed spazmodius closed 5 years ago
Logging should be errorless. console.log does not error, and you should not expect that any logging call could error.
That being said, have you got a specific case to reproduce this? There is no error in pino: only the transport destination thaf you pass in could emit error, so you should listen to its error there.
Ah, of course. Yes, I can hook the 'error'
event on the destination, assuming I opened it myself. I suppose there's no way to hook it if I pass a path or fd directly to pino()
?
@spazmodius - you can't pass an fd, and we recommend using pino.destination
:
const pino = require('pino')
const dest = pino.destination('/some/path')
dest.on('error', () => { ... })
const logger = pino(dest)
closing as there is a way to handle destination errors
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
It seems that Pino does not raise it's
'error'
event.How should one handle, say, a transport that goes away? Is it expected that calls to Pino will be
try/catch
'd? Even that would not catch errors that happen during an async write operation.