diff --git a/lib/bunyan.js b/lib/bunyan.js index ef57278..db619a3 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -349,7 +349,7 @@ function Logger(options, _childOptions, _childSimple) { level: (options.level ? resolveLevel(options.level) : INFO) }); } else if (options.streams) { - options.streams.forEach(function(s) { + options.streams.forEach(function (s) { s.level = s.level || s.level; self.addStream(s); }); @@ -414,7 +414,7 @@ util.inherits(Logger, EventEmitter); * 'file' stream when `path` is given, false otherwise. * See README.md for full details. */ -Logger.prototype.addStream = function(s) { +Logger.prototype.addStream = function addStream(s) { var self = this; s = objCopy(s); @@ -440,12 +440,12 @@ Logger.prototype.addStream = function(s) { } switch (s.type) { - case 'stream': + case 'stream': if (!s.closeOnExit) { s.closeOnExit = false; } break; - case 'file': + case 'file': if (!s.stream) { s.stream = fs.createWriteStream(s.path, {flags: 'a', encoding: 'utf8'}); @@ -461,7 +461,7 @@ Logger.prototype.addStream = function(s) { } } break; - case 'rotating-file': + case 'rotating-file': assert.ok(!s.stream, '"rotating-file" stream should not give a "stream"'); assert.ok(s.path); @@ -472,12 +472,12 @@ Logger.prototype.addStream = function(s) { s.closeOnExit = true; } break; - case 'raw': + case 'raw': if (!s.closeOnExit) { s.closeOnExit = false; } break; - default: + default: throw new TypeError('unknown stream type "' + s.type + '"'); } @@ -488,10 +488,10 @@ Logger.prototype.addStream = function(s) { /** * Add serializers * - * @param serializers {Object} Optional. Object mapping log record field names to - * serializing functions. See README.md for details. + * @param serializers {Object} Optional. Object mapping log record field names + * to serializing functions. See README.md for details. */ -Logger.prototype.addSerializers = function(serializers) { +Logger.prototype.addSerializers = function addSerializers(serializers) { var self = this; if (!self.serializers) { diff --git a/test/ctor.test.js b/test/ctor.test.js index 57920e6..f47cb9d 100644 --- a/test/ctor.test.js +++ b/test/ctor.test.js @@ -31,6 +31,7 @@ test('ensure Logger creation options', function (t) { var options = {name: 'foo', stream: process.stdout, streams: []}; t.throws(function () { new Logger(options); }, + /* JSSTYLED */ /cannot mix "streams" and "stream" options/, 'cannot use "stream" and "streams"'); @@ -76,6 +77,7 @@ test('ensure Logger creation options (createLogger)', function (t) { var options = {name: 'foo', stream: process.stdout, streams: []}; t.throws(function () { bunyan.createLogger(options); }, + /* JSSTYLED */ /cannot mix "streams" and "stream" options/, 'cannot use "stream" and "streams"'); @@ -114,6 +116,7 @@ test('ensure Logger child() options', function (t) { var options = {stream: process.stdout, streams: []}; t.throws(function () { log.child(options); }, + /* JSSTYLED */ /cannot mix "streams" and "stream" options/, 'cannot use "stream" and "streams"');