I configured pino with pretty-print to log calls in a Node js project to the console. Unfortunately, the output does not display the timestamp I configured. I am using pino version 8.17.2 and pretty-print version 10.3.1. Here is my configured logger:
const levels = {
http: 10,
debug: 20,
info: 30,
warn: 40,
error: 50,
fatal: 60,
};
const logger = pino({
level: 'info',
useOnlyCustomLevels: true,
customLevels: levels,
transport: {
target: 'pino-pretty',
options: {
colorize: true,
colorizeObjects: true,
translateTimestamp: "SYS:yyyy-mm-dd HH:MM:ss.l",
minimumLevel: 'info',
timestamp: "SYS:yyyy-mm-dd HH:MM:ss.l",
levelFirst: true,
ignore: 'pid,hostname',
levels: levels,
}
}
})
I use the log in this way:
logger.info('This is a log message') and output is which has no timestamp
INFO [18:06:00.159]: This is a log message
I used the following: translateTime: "SYS:yyyy-mm-dd HH:MM:ss.l",