pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.27k stars 150 forks source link

Dissapering logs with fatal #304

Closed wiktor-obrebski closed 2 years ago

wiktor-obrebski commented 2 years ago

In this example the fatal log never appear:

const pino = require('pino');
const pinoPretty = require('pino-pretty');

const logger = pino(
  { level: 'info' },
  pinoPretty({
    levelFirst: true,
    colorize: true,
    translateTime: 'yyyy-mm-dd HH:MM:ss',
  })
);

logger.info('test 123');
logger.fatal(new Error('not visible'));
process.exit(1)

It's clearly pino-pretty issue, as it does not happen with raw pino. sync: true, is workaround.

mcollina commented 2 years ago

Thanks, this is working as expected! However we need to add the following block that's missing:

https://github.com/pinojs/pino/blob/f8696ab5fb0e5a819b6255af420b29fb075cbdee/lib/tools.js#L335-L373

edobry commented 2 years ago

hello, I am also facing this issue and I can't get the workaround to work; where exactly do you specify sync: true?

wiktor-obrebski commented 2 years ago

https://github.com/pinojs/pino-pretty#usage-with-jest u need to have version 7.5.1 of pino-pretty for this work (with TS)