0.0.71 • Published 4 years ago
@withbluedot/bunyan-rotating-filestream v0.0.71
Bunyan Rotating Filestream
Install
npm install @withbluedot/bunyan-rotating-filestream --save
or
yarn add @withbluedot/bunyan-rotating-filestream
Usage
Create a bunyan logger using the stream:
    var log = bunyan.createLogger({
        name: 'foo',
        streams: [{
            stream: new RotatingFileStream({
                path: '/var/log/foo.log',
                period: '1d',          // daily rotation
                totalFiles: 10,        // keep up to 10 backup copies
                rotateExisting: true,  // Give ourselves a clean file when we start up, based on period
                threshold: '10m',      // Rotate log files larger than 10 megabytes
                totalSize: '20m',      // Don't keep more than 20mb of archived log files
                gzip: true             // Compress the archive log files to save space
            })
        }]
    });Other options include startNewFile to always open a new file on start-up.
Develop
- git clonethis repo &- cdinto it as usual
- Run yarnto install top-level dependencies.
Test
- yarn lintrun just eslint
- yarn testrun lint and tests
Publish
- yarn ship
Credit
Many thanks to @Rcomian for their work on the original bunyan-rotating-file-stream project, this project borrows lots of the code and all of the ideas in the original.
Copyright & License
Copyright (c) 2013-2021 Ghost Foundation - Released under the MIT license.