Skip to content

Commit

Permalink
docs: the rotating-file-stream module creates the log directory
Browse files Browse the repository at this point in the history
closes #182
  • Loading branch information
davidjb authored and dougwilson committed Nov 5, 2018
1 parent c1e027e commit 6f23fca
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,21 +312,16 @@ file per day in the `log/` directory using the

```js
var express = require('express')
var fs = require('fs')
var morgan = require('morgan')
var path = require('path')
var rfs = require('rotating-file-stream')

var app = express()
var logDirectory = path.join(__dirname, 'log')

// ensure log directory exists
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory)

// create a rotating write stream
var accessLogStream = rfs('access.log', {
interval: '1d', // rotate daily
path: logDirectory
path: path.join(__dirname, 'log')
})

// setup the logger
Expand Down

0 comments on commit 6f23fca

Please sign in to comment.