Skip to content

Commit 1f687f6

Browse files
committed
Replicate bunyan functionality for backup count
1 parent 8d3d469 commit 1f687f6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Create a bunyan logger using the stream:
2020
stream: new RotatingFileStream({
2121
path: '/var/log/foo.log',
2222
period: '1d', // daily rotation
23-
totalFiles: 10, // keep up to 10 back copies
23+
totalFiles: 10, // keep up to 10 backup copies
2424
rotateExisting: true, // Give ourselves a clean file when we start up, based on period
2525
threshold: '10m', // Rotate log files larger than 10 megabytes
2626
totalSize: '20m', // Don't keep more than 20mb of archived log files

lib/fileRotator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class FileRotator extends EventEmitter {
124124
try {
125125
const result = await fs.stat(name);
126126
bytesTotal += result.size;
127-
if ((this._totalSize && bytesTotal > this._totalSize) || (this._totalFiles && fileNumber + 1 > this._totalFiles)) {
127+
if ((this._totalSize && bytesTotal > this._totalSize) || (this._totalFiles && fileNumber > this._totalFiles)) {
128128
filesToDelete.push(name);
129129
}
130130
} catch (err) {

0 commit comments

Comments
 (0)