improve rotating-file assert on 'count' field

Fixes #207, #208
This commit is contained in:
Trent Mick 2015-01-16 09:00:10 -08:00
parent 783b1c4e39
commit d77f824723

View file

@ -1051,7 +1051,12 @@ function RotatingFileStream(options) {
this.stream = fs.createWriteStream(this.path,
{flags: 'a', encoding: 'utf8'});
this.count = (options.count == null ? 10 : options.count);
assert.ok(typeof (this.count) === 'number' && this.count >= 0);
assert.equal(typeof (self.count), 'number',
format('rotating-file stream "count" is not a number: %j (%s) in %j',
self.count, typeof(self.count), self));
assert.ok(self.count >= 0,
format('rotating-file stream "count" is not >= 0: %j in %j',
self.count, self));
// Parse `options.period`.
if (options.period) {