From d77f824723ce5d7a4de7a958ac04fe5d44f4ce3e Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Fri, 16 Jan 2015 09:00:10 -0800 Subject: [PATCH] improve rotating-file assert on 'count' field Fixes #207, #208 --- lib/bunyan.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/bunyan.js b/lib/bunyan.js index c3628f1..8ee1361 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -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) {