Last active
August 30, 2015 15:21
-
-
Save electblake/564a49bec8abb0e536b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs-extra'), | |
| path = require('path'), | |
| bunyan = require('bunyan'); | |
| var logDir = path.resolve(path.join('./', 'log')); | |
| fs.ensureDir(logDir); | |
| module.exports = bunyan.createLogger({ | |
| name: 'app-name', | |
| streams: [ | |
| { | |
| level: 'debug', | |
| stream: process.stdout | |
| }, | |
| { | |
| level: 'error', | |
| type: 'rotating-file', | |
| path: path.join(logDir, 'error.log'), | |
| period: '1d', // daily rotation | |
| count: 3 // keep 3 back copies | |
| }, | |
| { | |
| level: 'info', | |
| type: 'rotating-file', | |
| path: path.join(logDir, 'run.log'), | |
| period: '1d', // daily rotation | |
| count: 1 // keep 3 back copies | |
| }, | |
| { | |
| level: 'debug', | |
| type: 'rotating-file', | |
| path: path.join(logDir, 'debug.log'), | |
| period: '1h', | |
| count: 3 | |
| } | |
| ] | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment