improve rotating-file assert on 'count' field

Fixes #207, #208
master
Trent Mick 2015-01-16 09:00:10 -08:00
parent 783b1c4e39
commit d77f824723
1 changed files with 6 additions and 1 deletions

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) {