'Format pino file stream with pino-pretty
I build my first logger for my discord .js bot.
Now I need help with this:
How can I format the output fs stream also with pino-pretty? This is my code
var fs = require('fs');
var pinoms = require('pino-multi-stream')
const date = new Date()
const prettyStream = pinoms.prettyStream({ prettyPrint: { colorize: true, translateTime: "SYS:standard", ignore: "hostname,pid" } });
var streams = [
{stream: fs.createWriteStream(`logs/${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()}-${date.getHours()}-${date.getMinutes()}.log`) },
{stream: prettyStream }
]
var logger = pinoms(pinoms.multistream(streams))
module.exports = logger;
I've looked for some solutions but couldn't find anything. Please help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
