'How to save Pino logs in save fomatted by pino-pretty

first of all I thank you for the help.

I want to save the pino-logs in a file (I go it) with the pretty-format. The pretty works successfully in terminal logs but the file's log doesn't have pino-format.

This's my code

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

const createSonicBoom = (dest) =>
  pino.destination({ dest: dest, append: true, sync: true })

const streams = [
  { stream: pretty({
    sync: true
  }) },
  { level:'info', stream: createSonicBoom(`${__dirname}/../../logger-info.log`) },
  { level:'error', stream: createSonicBoom(`${__dirname}/../../logger-error.log`) }
]

const logger = pino({}, pino.multistream(streams))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source