2

I'm trying to setup a simple daily rotation log write with:

// Create file transport
transports.push(new winston.transports.DailyRotateFile({
  name: 'file',
  datePattern: '.yyyy-MM-ddTHH',
  filename: path.join(logPath, 'http')
}));

// Create new logger
var logger = new winston.Logger({
  transports: transports
});

It's creating the log file just fine, however logger.info(some_data) doesn't write anything to the log.

Any thoughts, or even another solution?

4

1 回答 1

2

这个适用于分钟旋转:

var winston = require('winston');


var logger = new (winston.Logger)({
  transports: [
    new (winston.transports.DailyRotateFile)({ filename: 'logFile', datePattern: '.yyyy-MM-dd_HH-mm' })
  ]
});


logger.info('Hello my friend');
于 2014-12-03T10:01:43.777 回答