'make check' clean

This commit is contained in:
Trent Mick 2014-08-25 00:50:53 -07:00
parent a3e7081be6
commit 7ef6b120db
2 changed files with 13 additions and 10 deletions

View file

@ -349,7 +349,7 @@ function Logger(options, _childOptions, _childSimple) {
level: (options.level ? resolveLevel(options.level) : INFO) level: (options.level ? resolveLevel(options.level) : INFO)
}); });
} else if (options.streams) { } else if (options.streams) {
options.streams.forEach(function(s) { options.streams.forEach(function (s) {
s.level = s.level || s.level; s.level = s.level || s.level;
self.addStream(s); self.addStream(s);
}); });
@ -414,7 +414,7 @@ util.inherits(Logger, EventEmitter);
* 'file' stream when `path` is given, false otherwise. * 'file' stream when `path` is given, false otherwise.
* See README.md for full details. * See README.md for full details.
*/ */
Logger.prototype.addStream = function(s) { Logger.prototype.addStream = function addStream(s) {
var self = this; var self = this;
s = objCopy(s); s = objCopy(s);
@ -440,12 +440,12 @@ Logger.prototype.addStream = function(s) {
} }
switch (s.type) { switch (s.type) {
case 'stream': case 'stream':
if (!s.closeOnExit) { if (!s.closeOnExit) {
s.closeOnExit = false; s.closeOnExit = false;
} }
break; break;
case 'file': case 'file':
if (!s.stream) { if (!s.stream) {
s.stream = fs.createWriteStream(s.path, s.stream = fs.createWriteStream(s.path,
{flags: 'a', encoding: 'utf8'}); {flags: 'a', encoding: 'utf8'});
@ -461,7 +461,7 @@ Logger.prototype.addStream = function(s) {
} }
} }
break; break;
case 'rotating-file': case 'rotating-file':
assert.ok(!s.stream, assert.ok(!s.stream,
'"rotating-file" stream should not give a "stream"'); '"rotating-file" stream should not give a "stream"');
assert.ok(s.path); assert.ok(s.path);
@ -472,12 +472,12 @@ Logger.prototype.addStream = function(s) {
s.closeOnExit = true; s.closeOnExit = true;
} }
break; break;
case 'raw': case 'raw':
if (!s.closeOnExit) { if (!s.closeOnExit) {
s.closeOnExit = false; s.closeOnExit = false;
} }
break; break;
default: default:
throw new TypeError('unknown stream type "' + s.type + '"'); throw new TypeError('unknown stream type "' + s.type + '"');
} }
@ -488,10 +488,10 @@ Logger.prototype.addStream = function(s) {
/** /**
* Add serializers * Add serializers
* *
* @param serializers {Object} Optional. Object mapping log record field names to * @param serializers {Object} Optional. Object mapping log record field names
* serializing functions. See README.md for details. * to serializing functions. See README.md for details.
*/ */
Logger.prototype.addSerializers = function(serializers) { Logger.prototype.addSerializers = function addSerializers(serializers) {
var self = this; var self = this;
if (!self.serializers) { if (!self.serializers) {

View file

@ -31,6 +31,7 @@ test('ensure Logger creation options', function (t) {
var options = {name: 'foo', stream: process.stdout, streams: []}; var options = {name: 'foo', stream: process.stdout, streams: []};
t.throws(function () { new Logger(options); }, t.throws(function () { new Logger(options); },
/* JSSTYLED */
/cannot mix "streams" and "stream" options/, /cannot mix "streams" and "stream" options/,
'cannot use "stream" and "streams"'); '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: []}; var options = {name: 'foo', stream: process.stdout, streams: []};
t.throws(function () { bunyan.createLogger(options); }, t.throws(function () { bunyan.createLogger(options); },
/* JSSTYLED */
/cannot mix "streams" and "stream" options/, /cannot mix "streams" and "stream" options/,
'cannot use "stream" and "streams"'); 'cannot use "stream" and "streams"');
@ -114,6 +116,7 @@ test('ensure Logger child() options', function (t) {
var options = {stream: process.stdout, streams: []}; var options = {stream: process.stdout, streams: []};
t.throws(function () { log.child(options); }, t.throws(function () { log.child(options); },
/* JSSTYLED */
/cannot mix "streams" and "stream" options/, /cannot mix "streams" and "stream" options/,
'cannot use "stream" and "streams"'); 'cannot use "stream" and "streams"');