I’m running a node script that logs with Pino
and then piping into pino-pretty
.
I want each log line to show '[TIME] [LEVEL] [MSG]'
My script is simply
import pino from 'pino'
const logger = pino({})
logger.fatal('this is a fatal error');
logger.error('this is an error');
logger.warn('this is a warning');
logger.info('this is info');
logger.debug('this is debug');
logger.trace('this is trace');
and I’m running it like node foo.js | pino-pretty -I 'level,time,msg' -o '{time} {level} {msg}'
But then my output is like
[12:30:15.321] FATAL: 1717173015321 60 this is a fatal error
[12:30:15.321] ERROR: 1717173015321 50 this is an error
So it’s only the msg itself that gets formatted. How can I change the actual log part?