0.0.5 • Published 9 years ago

winston-archivefile v0.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

winston-archivefile

Motivation

I needed a winston transport that rotated the log file by writing a constant filename and only add the date when the date rolls over. e.g.

myLog.log <= Current log file being written to myLog.2015-03-30.log <= Yesterdays log file

This is also my first github project of my own. So any feedback/help is more than welcome.

Most of the code is a copy of the DailyRotateFile transport code in the main winston repository

Usage

var winston = require('winston');
var archiveFile = require('winston-archivefile');

var options = {
	filename: "myLog.log",
	archivedir: "archive"
};

var trans = new archiveFile(options);
var logger = new winston.Logger({
	transports: [trans]
});

Options

ArchiveFile takes the following options:

  • filename : full path and filename of the log file default: ./winston.log
  • archivedir : path to archive old log files to: default: dir of filename
  • formatter : function to format the entry. signature function(level, msg, meta). default format: {timestamp} {level} {message} {meta}
  • EOL : End of line char sequence. default: \n

Testing

Unit tests written using jasmine-node. Simply run

jasmine-node spec

Unit tests are a bit thin on the ground and I must put more effort into them, I know. If anyone else wants to write them please feel free.

LICENCE

MIT licence