docs/pretty.md
By default, Pino log lines are newline delimited JSON (NDJSON). This is perfect
for production usage and long-term storage. It's not so great for development
environments. Thus, Pino logs can be prettified by using a Pino prettifier
module like pino-pretty:
npm install pino-pretty.transport.target option set to 'pino-pretty':const pino = require('pino')
const logger = pino({
transport: {
target: 'pino-pretty'
},
})
logger.info('hi')
pino-pretty options:const pino = require('pino')
const logger = pino({
transport: {
target: 'pino-pretty',
options: {
colorize: true
}
}
})
logger.info('hi')
Note: The logger.flush() method does not work when using pino-pretty. See
Flush Limitations with pino-pretty for more details.