A performant file transport providing daily log rotation for winston.
npm install fast-file-rotate
const FileRotateTransport = require('fast-file-rotate');
const winston = require('winston');
const logger = winston.createLogger({
transports: [
new FileRotateTransport({
fileName: __dirname + '/console%DATE%.log',
dateFormat: 'DDMMYYYY'
})
]
})
The name of the log file(s). Must contain a %DATE%
placeholder.
The format of the date that will replace the placeholder %DATE%
in the file name. Defaults to DDMMYYYY
.
Supports all formating options of fast-date-format.
The size of the internal buffer that is used to store the logs before writing them to the file. Defaults to 4096
.
The benchmark compares to the winston-daily-rotate-file module:
benchFastFileRotate*10000: 175.397ms
benchWinstonDailyRotateFile*10000: 580.341ms
benchFastFileRotate*10000: 141.746ms
benchWinstonDailyRotateFile*10000: 545.736ms