var winston = require('winston');
var DailyRotateFile = require('winston-daily-rotate-file');
var transport = new DailyRotateFile({
filename: 'application-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
watchLog: true,
});
transport.on('new', function(newFile) {
console.log('new', newFile)
});
var logger = winston.createLogger({
transports: [
transport
]
});
setInterval(() => {
console.log('hello')
logger.info(`Hello World!: ${new Date()}`);
}, 500);
After the second delete file by rm application-*.log, the winston-daily-rotate-file not auto create the log file.
While the first delete file works, it auto create the log file.
This is a showcase:
After the second delete file by
rm application-*.log
, thewinston-daily-rotate-file
not auto create the log file. While the first delete file works, it auto create the log file.