Name: winston-daily-rotate-file
Owner: winstonjs
Description: A transport for winston which logs to a rotating file each day.
Created: 2015-09-18 21:54:38.0
Updated: 2018-05-23 20:31:02.0
Pushed: 2018-05-10 22:00:00.0
Homepage: null
Size: 138
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A transport for winston which logs to a rotating file. Logs can be rotated based on a date, size limit, and old logs can be removed based on count or elapsed days.
Starting with version 2.0.0, the transport has been refactored to leverage the the file-stream-rotator module. Some of the options in the 1.x versions of the transport have changed. Please review the options below to identify any changes needed.
install winston-daily-rotate-file
The DailyRotateFile transport can rotate files by minute, hour, day, month, year or weekday. In addition to the options accepted by the logger, winston-daily-rotate-file
also accepts the following options:
%DATE%
placeholder which will include the formatted datePattern at that point in the filename. (default: 'winston.log.%DATE%)r winston = require('winston');
quire('winston-daily-rotate-file');
r transport = new (winston.transports.DailyRotateFile)({
filename: 'application-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: true,
maxSize: '20m',
maxFiles: '14d'
;
ansport.on('rotate', function(oldFilename, newFilename) {
// do something fun
;
r logger = new (winston.Logger)({
transports: [
transport
]
;
gger.info('Hello World!');
You can listen for the rotate custom event. The rotate event will pass two parameters to the callback (oldFilename, newFilename).
MIT