Pino: TypeError: this[writeSym] is not a function

Created on 12 Aug 2019  路  1Comment  路  Source: pinojs/pino

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)

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:

const pino = require('pino')();

process.on('uncaughtException', pino.fatal.bind(pino));

asd.asd = 200;

>All comments

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;
Was this page helpful?
0 / 5 - 0 ratings

Related issues

callumlocke picture callumlocke  路  4Comments

NicolaiSchmid picture NicolaiSchmid  路  4Comments

afgallo picture afgallo  路  4Comments

stephenmathieson picture stephenmathieson  路  6Comments

dunklesToast picture dunklesToast  路  3Comments