Bunyan Rotating Filestream
Install
npm install @tryghost/bunyan-rotating-filestream --save
or
yarn add @tryghost/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',
totalFiles: 10,
rotateExisting: true,
threshold: '10m',
totalSize: '20m',
gzip: true
})
}]
});
Other options include startNewFile
to always open a new file on start-up.
Develop
git clone
this repo & cd
into it as usual- Run
yarn
to install top-level dependencies.
Test
yarn lint
run just eslintyarn test
run lint and tests
Publish
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.