hlandao / winston-daily-rotate-file

A transport for winston which logs to a rotating file each day.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

winston-daily-rotate-file

NPM version Build Status Dependency Status

A transport for winston which logs to a rotating file each day.

Usage

  winston.add(require('winston-daily-rotate-file'), options)

The DailyRotateFile transport can rotate files by minute, hour, day, month, year or weekday. In addition to the options accepted by the File transport, the Daily Rotate File Transport also accepts the following options:

  • datePattern: A string representing the pattern to be used when appending the date to the filename (default 'yyyy-MM-dd'). The meta characters used in this string will dictate the frequency of the file rotation. For example, if your datePattern is simply 'HH' you will end up with 24 log files that are picked up and appended to every day.
  • prepend: Defines if the rolling time of the log file should be prepended at the beginning of the filename (default 'false').

Valid meta characters in the datePattern are:

  • yy: Last two digits of the year.
  • yyyy: Full year.
  • M: The month.
  • MM: The zero padded month.
  • d: The day.
  • dd: The zero padded day.
  • H: The hour.
  • HH: The zero padded hour.
  • m: The minute.
  • mm: The zero padded minute.
  • ddd: The weekday (Mon, Tue, ..., Sun).

Metadata: Logged via util.inspect(meta);

LICENSE

MIT

AUTHOR: Charlie Robbins
MAINTAINER: Matt Berther

About

A transport for winston which logs to a rotating file each day.

License:MIT License


Languages

Language:JavaScript 100.0%