i am using winston to add logs in my nodejs project which is basically a kakfka based service which runs 24 x 7, below code only generate log on separate file(the file dated when the service restarted) but it only changes file when the i restart the server after the change date, is their anything which automatically changes the log file when the day changes.
const {createLogger, format, transports} = require("winston");
const {combine, timestamp, label, prettyPrint} = format;
const logger = createLogger({
level: "info",
format: format.combine(
format.splat(),
format.simple(),
format.json(),
timestamp(),
prettyPrint()
),
transports: [
new transports.File({
filename: `${appRoot}/Log/error/Log_${new Date().getUTCDate()}-${new Date().getMonth()}-${new Date().getFullYear()}.log`,
level: "error",
handleExceptions: true,
json: true,
stack: true,
}),
],
exitOnError: false,
});
module.exports = logger;