In my project, there is an option for creating apps. Based on app Id, I need to create folder named app Id and keep trace.log, out.log etc files separately. For logging, pino is used for that.
let dir = process.env.LOG_FILE_PATH+"/"+appId;
!fs.existsSync(dir) && fs.mkdirSync(dir);
logger = pino({
level: level,
customLevels: {
perf: 25,
audit: 28
},
timestamp: pino.stdTimeFunctions.isoTime,
},
pino.destination(dir+"/trace.log")
);
Is there any way to create log folder based on condition and keep the logs files within it.