Hi,
I encountered the following issue, while using pino with process event 'uncaughtException'
`
const pino = require('pino')();
process.on('uncaughtException', pino.fatal);
asd.asd = 200;
`
I get the following error :
TypeError: this[writeSym] is not a function
at process.LOG (/Users/asl/Workspace/todel/node_modules/pino/lib/tools.js:36:21)
at emitOne (events.js:116:13)
at process.emit (events.js:211:7)
at process._fatalException (bootstrap_node.js:391:26)
Pino logger methods are not bound to their object. If you plan to use them as functions, you need to bind them yourself:
const pino = require('pino')();
process.on('uncaughtException', pino.fatal.bind(pino));
asd.asd = 200;
Most helpful comment
Pino logger methods are not bound to their object. If you plan to use them as functions, you need to bind them yourself: