npm.io
1.0.1 • Published 10 years ago

daily-file-writer

Licence
MIT
Version
1.0.1
Deps
1
Vulns
0
Weekly
0

daily-file-writer

Build Status Coverage Status

Write data to a log file using the date as the filename. Handles date rollover too!

Note: Requires Node.js v4+

Install

$ npm install [--save] daily-file-writer

Test

$ npm test

Usage

'use strict'

const Writer = require('daily-file-writer')
const writer = new Writer({
  path: '/tmp/logs'
})

writer.write('blah blah')

// the log file will be something like:
// /tmp/logs/2016-01-02.txt

// when a write comes in and the date has changed,
// the previous file will be closed and the data will be written to a new file
// /tmp/logs/2016-01-03.txt

Author

Evan Lucas

License

MIT (See LICENSE for more info)