I am trying to use pino for logging in to my node app Server and I do have some large logs coming, so rotating the files every day would be more useful for reading the logs afterwards.
I can do this using morgan but with pino I can't find a way to do it. I tried to dynamically assign the folder based on the current date but doing so in the main app.js file means it will only run once and cycling date would mean stopping and rerunning the server.
Here is my code:
var date = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate();
const fileLogger = pino(
pino.destination({
dest: './log/userLog '+date, sync: false
})
);