Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File transport with maxFiles doesn't seem to behave as expected #566

Closed
nimrod-becker opened this issue Mar 3, 2015 · 1 comment
Closed

Comments

@nimrod-becker
Copy link
Contributor

I have following usage of winston with file transport:
this._log = new(winston.Logger)({
transports: [
new(winston.transports.File)({
name: 'file_transp',
level: 'debug',
showLevel: false,
filename: 'test.log',
dirname: './',
maxsize: 1024,
maxFiles: 3,
}
})
]
});

When writing to it and exceeding the maxsize, new files are created just as expected. However, the number of files saved is not limited to 3 (I got to 28).

looking at transports/file.js, func _checkMaxFilesIncrementing, line 557.
557: target = path.join(this.dirname, basename + (oldest === 0 ? oldest : '') + ext);
558: fs.unlink(target, callback);

It seems to me that it should be oldest !== 0 (verified to work with the parameters I've written above).

indexzero added a commit that referenced this issue Mar 16, 2015
Issue #566 maxFiles doesn't seem to behave as expected
@nimrod-becker
Copy link
Contributor Author

Closed with pull request 578.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant