Skip to content
A performant file transport providing daily log rotation for winston.
JavaScript
Branch: master
Clone or download
SerayaEryn Merge pull request #19 from SerayaEryn/greenkeeper/standard-13.0.1
Update standard to the latest version 🚀
Latest commit 7cc605c Jul 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmark
lib use daily-rotating-file-stream Jan 6, 2019
test
.gitignore initial commit Jul 31, 2018
.npmrc initial commit Jul 31, 2018
.travis.yml add node 12 to travis ci May 4, 2019
LICENSE
README.md improve readme Jan 6, 2019
package.json

README.md

fast-file-rotate

Build Status Coverage Status NPM version Greenkeeper badge JavaScript Style Guide

A performant file transport providing daily log rotation for winston.

Install

npm install fast-file-rotate

Example

const FileRotateTransport = require('fast-file-rotate');
const winston = require('winston');

const logger = winston.createLogger({
  transports: [
    new FileRotateTransport({
      fileName: __dirname + '/console%DATE%.log',
      dateFormat: 'DDMMYYYY'
    })
  ]
})

API

FileRotateTransport(options)

fileName

The name of the log file(s). Must contain a %DATE% placeholder.

dateFormat (optional)

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.

bufferSize (optional)

The size of the internal buffer that is used to store the logs before writing them to the file. Defaults to 4096.

Benchmark

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

License

MIT

You can’t perform that action at this time.