more 'make check' jsstyle fixes
This commit is contained in:
parent
c9f05b6743
commit
7a6c3f5ce6
11 changed files with 78 additions and 73 deletions
45
bin/bunyan
45
bin/bunyan
|
@ -20,8 +20,8 @@ var child_process = require('child_process'),
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var nodeSpawnSupportsStdio = (
|
var nodeSpawnSupportsStdio = (
|
||||||
Number(process.version.split('.')[0]) >= 0
|
Number(process.version.split('.')[0]) >= 0 ||
|
||||||
|| Number(process.version.split('.')[1]) >= 8);
|
Number(process.version.split('.')[1]) >= 8);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ function getVersion() {
|
||||||
|
|
||||||
var format = util.format;
|
var format = util.format;
|
||||||
if (!format) {
|
if (!format) {
|
||||||
|
/* BEGIN JSSTYLED */
|
||||||
// If not node 0.6, then use its `util.format`:
|
// If not node 0.6, then use its `util.format`:
|
||||||
// <https://github.com/joyent/node/blob/master/lib/util.js#L22>:
|
// <https://github.com/joyent/node/blob/master/lib/util.js#L22>:
|
||||||
var inspect = util.inspect;
|
var inspect = util.inspect;
|
||||||
|
@ -140,6 +141,7 @@ if (!format) {
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
/* END JSSTYLED */
|
||||||
}
|
}
|
||||||
|
|
||||||
function indent(s) {
|
function indent(s) {
|
||||||
|
@ -399,7 +401,7 @@ function parseArgv(argv) {
|
||||||
var endOfOptions = false;
|
var endOfOptions = false;
|
||||||
while (args.length > 0) {
|
while (args.length > 0) {
|
||||||
var arg = args.shift();
|
var arg = args.shift();
|
||||||
switch(arg) {
|
switch (arg) {
|
||||||
case '--':
|
case '--':
|
||||||
endOfOptions = true;
|
endOfOptions = true;
|
||||||
break;
|
break;
|
||||||
|
@ -438,7 +440,7 @@ function parseArgv(argv) {
|
||||||
}
|
}
|
||||||
parsed.outputMode = OM_FROM_NAME[name];
|
parsed.outputMode = OM_FROM_NAME[name];
|
||||||
if (parsed.outputMode === undefined) {
|
if (parsed.outputMode === undefined) {
|
||||||
throw new Error('unknown output mode: \''+name+"'");
|
throw new Error('unknown output mode: "'+name+'"');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '-j': // output with JSON.stringify
|
case '-j': // output with JSON.stringify
|
||||||
|
@ -979,7 +981,7 @@ function processStdin(opts, stylize, callback) {
|
||||||
}
|
}
|
||||||
leftover = lines.pop();
|
leftover = lines.pop();
|
||||||
length -= 1;
|
length -= 1;
|
||||||
for (var i=1; i < length; i++) {
|
for (var i = 1; i < length; i++) {
|
||||||
handleLogLine(null, lines[i], opts, stylize);
|
handleLogLine(null, lines[i], opts, stylize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1095,7 +1097,7 @@ function processPids(opts, stylize, callback) {
|
||||||
}
|
}
|
||||||
leftover = lines.pop();
|
leftover = lines.pop();
|
||||||
length -= 1;
|
length -= 1;
|
||||||
for (var i=1; i < length; i++) {
|
for (var i = 1; i < length; i++) {
|
||||||
handleLogLine(null, lines[i], opts, stylize);
|
handleLogLine(null, lines[i], opts, stylize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1165,7 +1167,7 @@ function processFile(file, opts, stylize, callback) {
|
||||||
}
|
}
|
||||||
leftover = lines.pop();
|
leftover = lines.pop();
|
||||||
length -= 1;
|
length -= 1;
|
||||||
for (var i=1; i < length; i++) {
|
for (var i = 1; i < length; i++) {
|
||||||
handleLogLine(file, lines[i], opts, stylize);
|
handleLogLine(file, lines[i], opts, stylize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1186,6 +1188,7 @@ function processFile(file, opts, stylize, callback) {
|
||||||
/**
|
/**
|
||||||
* From node async module.
|
* From node async module.
|
||||||
*/
|
*/
|
||||||
|
/* BEGIN JSSTYLED */
|
||||||
function asyncForEach(arr, iterator, callback) {
|
function asyncForEach(arr, iterator, callback) {
|
||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
if (!arr.length) {
|
if (!arr.length) {
|
||||||
|
@ -1207,6 +1210,7 @@ function asyncForEach(arr, iterator, callback) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
/* END JSSTYLED */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1316,7 +1320,7 @@ function main(argv) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (opts.pid && opts.args.length > 0) {
|
if (opts.pid && opts.args.length > 0) {
|
||||||
warn("bunyan: error: can't use both '-p PID' (%s) and file (%s) args",
|
warn('bunyan: error: can\'t use both "-p PID" (%s) and file (%s) args',
|
||||||
opts.pid, opts.args.join(' '));
|
opts.pid, opts.args.join(' '));
|
||||||
return drainStdoutAndExit(1);
|
return drainStdoutAndExit(1);
|
||||||
}
|
}
|
||||||
|
@ -1334,18 +1338,19 @@ function main(argv) {
|
||||||
// Pager.
|
// Pager.
|
||||||
var nodeVer = process.versions.node.split('.').map(Number);
|
var nodeVer = process.versions.node.split('.').map(Number);
|
||||||
var paginate = (
|
var paginate = (
|
||||||
process.stdout.isTTY
|
process.stdout.isTTY &&
|
||||||
&& process.stdin.isTTY
|
process.stdin.isTTY &&
|
||||||
&& !opts.pids // Don't page if following process output.
|
!opts.pids && // Don't page if following process output.
|
||||||
&& opts.args.length > 0 // Don't page if no file args to process.
|
opts.args.length > 0 && // Don't page if no file args to process.
|
||||||
&& process.platform !== 'win32'
|
process.platform !== 'win32' &&
|
||||||
&& nodeVer >= [0,8,0]
|
nodeVer >= [0, 8, 0] &&
|
||||||
&& (opts.paginate === true
|
(opts.paginate === true ||
|
||||||
|| (opts.paginate !== false
|
(opts.paginate !== false &&
|
||||||
&& (!process.env.BUNYAN_NO_PAGER
|
(!process.env.BUNYAN_NO_PAGER ||
|
||||||
|| process.env.BUNYAN_NO_PAGER.length === 0))));
|
process.env.BUNYAN_NO_PAGER.length === 0))));
|
||||||
if (paginate) {
|
if (paginate) {
|
||||||
var pagerCmd = process.env.PAGER || 'less';
|
var pagerCmd = process.env.PAGER || 'less';
|
||||||
|
/* JSSTYLED */
|
||||||
assert.ok(pagerCmd.indexOf('"') === -1 && pagerCmd.indexOf("'") === -1,
|
assert.ok(pagerCmd.indexOf('"') === -1 && pagerCmd.indexOf("'") === -1,
|
||||||
'cannot parse PAGER quotes yet');
|
'cannot parse PAGER quotes yet');
|
||||||
var argv = pagerCmd.split(/\s+/g);
|
var argv = pagerCmd.split(/\s+/g);
|
||||||
|
@ -1363,7 +1368,7 @@ function main(argv) {
|
||||||
pager = spawn(argv[0], argv.slice(1),
|
pager = spawn(argv[0], argv.slice(1),
|
||||||
// Share the stderr handle to have error output come
|
// Share the stderr handle to have error output come
|
||||||
// straight through. Only supported in v0.8+.
|
// straight through. Only supported in v0.8+.
|
||||||
{env: env, stdio: ['pipe',1,2]});
|
{env: env, stdio: ['pipe', 1, 2]});
|
||||||
stdout = pager.stdin;
|
stdout = pager.stdin;
|
||||||
|
|
||||||
// Early termination of the pager: just stop.
|
// Early termination of the pager: just stop.
|
||||||
|
@ -1431,7 +1436,7 @@ if (require.main === module) {
|
||||||
// place. The real fix is that `.end()` shouldn't be called on stdout
|
// place. The real fix is that `.end()` shouldn't be called on stdout
|
||||||
// in node core. Node v0.6.9 fixes that. Only guard for v0.6.0..v0.6.8.
|
// in node core. Node v0.6.9 fixes that. Only guard for v0.6.0..v0.6.8.
|
||||||
var nodeVer = process.versions.node.split('.').map(Number);
|
var nodeVer = process.versions.node.split('.').map(Number);
|
||||||
if ([0,6,0] <= nodeVer && nodeVer <= [0,6,8]) {
|
if ([0, 6, 0] <= nodeVer && nodeVer <= [0, 6, 8]) {
|
||||||
var stdout = process.stdout;
|
var stdout = process.stdout;
|
||||||
stdout.end = stdout.destroy = stdout.destroySoon = function () {
|
stdout.end = stdout.destroy = stdout.destroySoon = function () {
|
||||||
/* pass */
|
/* pass */
|
||||||
|
|
|
@ -50,7 +50,7 @@ function logOne() {
|
||||||
var msg = [randchoice(words), randchoice(words)].join(' ');
|
var msg = [randchoice(words), randchoice(words)].join(' ');
|
||||||
var delay = randint(300);
|
var delay = randint(300);
|
||||||
//console.warn('long-running about to log.%s(..., "%s")', level, msg)
|
//console.warn('long-running about to log.%s(..., "%s")', level, msg)
|
||||||
log[level]({"word": randchoice(words), "delay": delay}, msg);
|
log[level]({'word': randchoice(words), 'delay': delay}, msg);
|
||||||
timeout = setTimeout(logOne, delay);
|
timeout = setTimeout(logOne, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ var bunyan = require('..');
|
||||||
var ringbuffer = new bunyan.RingBuffer({ limit: 100 });
|
var ringbuffer = new bunyan.RingBuffer({ limit: 100 });
|
||||||
var log = new bunyan({
|
var log = new bunyan({
|
||||||
name: 'foo',
|
name: 'foo',
|
||||||
streams: [{
|
streams: [ {
|
||||||
type: 'raw',
|
type: 'raw',
|
||||||
stream: ringbuffer,
|
stream: ringbuffer,
|
||||||
level: 'debug'
|
level: 'debug'
|
||||||
}]
|
} ]
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info('hello world');
|
log.info('hello world');
|
||||||
|
|
|
@ -638,8 +638,9 @@ Logger.prototype._applySerializers = function (fields, excludeFields) {
|
||||||
// Check each serializer against these (presuming number of serializers
|
// Check each serializer against these (presuming number of serializers
|
||||||
// is typically less than number of fields).
|
// is typically less than number of fields).
|
||||||
Object.keys(this.serializers).forEach(function (name) {
|
Object.keys(this.serializers).forEach(function (name) {
|
||||||
if (fields[name] === undefined
|
if (fields[name] === undefined ||
|
||||||
|| (excludeFields && excludeFields[name])) {
|
(excludeFields && excludeFields[name]))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xxx('_applySerializers; apply to "%s" key', name)
|
xxx('_applySerializers; apply to "%s" key', name)
|
||||||
|
@ -900,7 +901,7 @@ var errSerializer = Logger.stdSerializers.err = function err(err) {
|
||||||
function safeCycles() {
|
function safeCycles() {
|
||||||
var seen = [];
|
var seen = [];
|
||||||
return function (key, val) {
|
return function (key, val) {
|
||||||
if (!val || typeof val !== 'object') {
|
if (!val || typeof (val) !== 'object') {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
if (seen.indexOf(val) !== -1) {
|
if (seen.indexOf(val) !== -1) {
|
||||||
|
|
|
@ -48,10 +48,10 @@ test('log.info(BUFFER)', function (t) {
|
||||||
var rec = catcher.records[catcher.records.length - 1];
|
var rec = catcher.records[catcher.records.length - 1];
|
||||||
t.equal(rec.msg, inspect(b),
|
t.equal(rec.msg, inspect(b),
|
||||||
format('log.%s msg is inspect(BUFFER)', lvl));
|
format('log.%s msg is inspect(BUFFER)', lvl));
|
||||||
t.ok(rec["0"] === undefined,
|
t.ok(rec['0'] === undefined,
|
||||||
'no "0" array index key in record: ' + inspect(rec["0"]));
|
'no "0" array index key in record: ' + inspect(rec['0']));
|
||||||
t.ok(rec["parent"] === undefined,
|
t.ok(rec['parent'] === undefined,
|
||||||
'no "parent" array index key in record: ' + inspect(rec["parent"]));
|
'no "parent" array index key in record: ' + inspect(rec['parent']));
|
||||||
|
|
||||||
log[lvl].call(log, b, 'bar');
|
log[lvl].call(log, b, 'bar');
|
||||||
var rec = catcher.records[catcher.records.length - 1];
|
var rec = catcher.records[catcher.records.length - 1];
|
||||||
|
|
|
@ -29,21 +29,21 @@ test('child can add stream', function (t) {
|
||||||
var dadStream = new CapturingStream();
|
var dadStream = new CapturingStream();
|
||||||
var dad = bunyan.createLogger({
|
var dad = bunyan.createLogger({
|
||||||
name: 'surname',
|
name: 'surname',
|
||||||
streams: [{
|
streams: [ {
|
||||||
type: 'raw',
|
type: 'raw',
|
||||||
stream: dadStream,
|
stream: dadStream,
|
||||||
level: 'info'
|
level: 'info'
|
||||||
}]
|
} ]
|
||||||
});
|
});
|
||||||
|
|
||||||
var sonStream = new CapturingStream();
|
var sonStream = new CapturingStream();
|
||||||
var son = dad.child({
|
var son = dad.child({
|
||||||
component: 'son',
|
component: 'son',
|
||||||
streams: [{
|
streams: [ {
|
||||||
type: 'raw',
|
type: 'raw',
|
||||||
stream: sonStream,
|
stream: sonStream,
|
||||||
level: 'debug'
|
level: 'debug'
|
||||||
}]
|
} ]
|
||||||
});
|
});
|
||||||
|
|
||||||
dad.info('info from dad');
|
dad.info('info from dad');
|
||||||
|
@ -66,11 +66,11 @@ test('child can set level of inherited streams', function (t) {
|
||||||
var dadStream = new CapturingStream();
|
var dadStream = new CapturingStream();
|
||||||
var dad = bunyan.createLogger({
|
var dad = bunyan.createLogger({
|
||||||
name: 'surname',
|
name: 'surname',
|
||||||
streams: [{
|
streams: [ {
|
||||||
type: 'raw',
|
type: 'raw',
|
||||||
stream: dadStream,
|
stream: dadStream,
|
||||||
level: 'info'
|
level: 'info'
|
||||||
}]
|
} ]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Intention here is that the inherited `dadStream` logs at 'debug' level
|
// Intention here is that the inherited `dadStream` logs at 'debug' level
|
||||||
|
@ -99,11 +99,11 @@ test('child can set level of inherited streams and add streams', function (t) {
|
||||||
var dadStream = new CapturingStream();
|
var dadStream = new CapturingStream();
|
||||||
var dad = bunyan.createLogger({
|
var dad = bunyan.createLogger({
|
||||||
name: 'surname',
|
name: 'surname',
|
||||||
streams: [{
|
streams: [ {
|
||||||
type: 'raw',
|
type: 'raw',
|
||||||
stream: dadStream,
|
stream: dadStream,
|
||||||
level: 'info'
|
level: 'info'
|
||||||
}]
|
} ]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Intention here is that the inherited `dadStream` logs at 'debug' level
|
// Intention here is that the inherited `dadStream` logs at 'debug' level
|
||||||
|
@ -112,11 +112,11 @@ test('child can set level of inherited streams and add streams', function (t) {
|
||||||
var son = dad.child({
|
var son = dad.child({
|
||||||
component: 'son',
|
component: 'son',
|
||||||
level: 'trace',
|
level: 'trace',
|
||||||
streams: [{
|
streams: [ {
|
||||||
type: 'raw',
|
type: 'raw',
|
||||||
stream: sonStream,
|
stream: sonStream,
|
||||||
level: 'debug'
|
level: 'debug'
|
||||||
}]
|
} ]
|
||||||
});
|
});
|
||||||
|
|
||||||
dad.info('info from dad');
|
dad.info('info from dad');
|
||||||
|
|
|
@ -31,27 +31,27 @@ outstr.end = function (c) {
|
||||||
var expect =
|
var expect =
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "blammo",
|
'name': 'blammo',
|
||||||
"level": 30,
|
'level': 30,
|
||||||
"msg": "bango { bang: 'boom', KABOOM: [Circular] }",
|
'msg': 'bango { bang: \'boom\', KABOOM: [Circular] }',
|
||||||
"v": 0
|
'v': 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blammo",
|
'name': 'blammo',
|
||||||
"level": 30,
|
'level': 30,
|
||||||
"msg": "kaboom { bang: 'boom', KABOOM: [Circular] }",
|
'msg': 'kaboom { bang: \'boom\', KABOOM: [Circular] }',
|
||||||
"v": 0
|
'v': 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blammo",
|
'name': 'blammo',
|
||||||
"level": 30,
|
'level': 30,
|
||||||
"bang": "boom",
|
'bang': 'boom',
|
||||||
"KABOOM": {
|
'KABOOM': {
|
||||||
"bang": "boom",
|
'bang': 'boom',
|
||||||
"KABOOM": "[Circular]"
|
'KABOOM': '[Circular]'
|
||||||
},
|
},
|
||||||
"msg": "",
|
'msg': '',
|
||||||
"v": 0
|
'v': 0
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -47,15 +47,15 @@ test('basic dtrace', function (t) {
|
||||||
'bunyan$target:::log-*{printf("%s", copyinstr(arg0))}',
|
'bunyan$target:::log-*{printf("%s", copyinstr(arg0))}',
|
||||||
'-c', format('node %s/log-some.js', __dirname)];
|
'-c', format('node %s/log-some.js', __dirname)];
|
||||||
var dtrace = spawn(argv[0], argv.slice(1));
|
var dtrace = spawn(argv[0], argv.slice(1));
|
||||||
//console.error("ARGV: %j", argv);
|
//console.error('ARGV: %j', argv);
|
||||||
|
|
||||||
var traces = [];
|
var traces = [];
|
||||||
dtrace.stdout.on('data', function (data) {
|
dtrace.stdout.on('data', function (data) {
|
||||||
//console.error("DTRACE STDOUT:", data.toString());
|
//console.error('DTRACE STDOUT:', data.toString());
|
||||||
traces.push(data.toString());
|
traces.push(data.toString());
|
||||||
});
|
});
|
||||||
dtrace.stderr.on('data', function (data) {
|
dtrace.stderr.on('data', function (data) {
|
||||||
console.error("DTRACE STDERR:", data.toString());
|
console.error('DTRACE STDERR:', data.toString());
|
||||||
});
|
});
|
||||||
dtrace.on('exit', function (code) {
|
dtrace.on('exit', function (code) {
|
||||||
t.notOk(code, 'dtrace exited cleanly');
|
t.notOk(code, 'dtrace exited cleanly');
|
||||||
|
|
|
@ -19,7 +19,7 @@ var test = tap4nodeunit.test;
|
||||||
test('error event on log write', function (t) {
|
test('error event on log write', function (t) {
|
||||||
LOG_PATH = '/this/path/is/bogus.log'
|
LOG_PATH = '/this/path/is/bogus.log'
|
||||||
var log = bunyan.createLogger(
|
var log = bunyan.createLogger(
|
||||||
{name: 'error-event', streams: [{path: LOG_PATH}]});
|
{name: 'error-event', streams: [ {path: LOG_PATH} ]});
|
||||||
log.on('error', function (err, stream) {
|
log.on('error', function (err, stream) {
|
||||||
t.ok(err, 'got err in error event: ' + err);
|
t.ok(err, 'got err in error event: ' + err);
|
||||||
t.equal(err.code, 'ENOENT', 'error code is ENOENT');
|
t.equal(err.code, 'ENOENT', 'error code is ENOENT');
|
||||||
|
|
|
@ -10,4 +10,3 @@ var log = bunyan.createLogger({
|
||||||
});
|
});
|
||||||
log.debug({foo: 'bar'}, 'hi at debug')
|
log.debug({foo: 'bar'}, 'hi at debug')
|
||||||
log.trace('hi at trace')
|
log.trace('hi at trace')
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,11 @@ test('req serializer', function (t) {
|
||||||
{},
|
{},
|
||||||
1,
|
1,
|
||||||
'string',
|
'string',
|
||||||
[1,2,3],
|
[1, 2, 3],
|
||||||
{'foo':'bar'}
|
{'foo':'bar'}
|
||||||
];
|
];
|
||||||
for (var i = 0; i < bogusReqs.length; i++) {
|
for (var i = 0; i < bogusReqs.length; i++) {
|
||||||
log.info({req: bogusReqs[i]}, "hi");
|
log.info({req: bogusReqs[i]}, 'hi');
|
||||||
t.equal(records[i].req, bogusReqs[i]);
|
t.equal(records[i].req, bogusReqs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ test('req serializer', function (t) {
|
||||||
res.end('Hello World\n');
|
res.end('Hello World\n');
|
||||||
})
|
})
|
||||||
server.listen(8765, function () {
|
server.listen(8765, function () {
|
||||||
http.get({host: '127.0.0.1', port: 8765, path: '/'}, function(res) {
|
http.get({host: '127.0.0.1', port: 8765, path: '/'}, function (res) {
|
||||||
res.resume();
|
res.resume();
|
||||||
log.info({req: theReq}, 'the request');
|
log.info({req: theReq}, 'the request');
|
||||||
var lastRecord = records[records.length-1];
|
var lastRecord = records[records.length-1];
|
||||||
|
@ -106,11 +106,11 @@ test('res serializer', function (t) {
|
||||||
{},
|
{},
|
||||||
1,
|
1,
|
||||||
'string',
|
'string',
|
||||||
[1,2,3],
|
[1, 2, 3],
|
||||||
{'foo':'bar'}
|
{'foo':'bar'}
|
||||||
];
|
];
|
||||||
for (var i = 0; i < bogusRess.length; i++) {
|
for (var i = 0; i < bogusRess.length; i++) {
|
||||||
log.info({res: bogusRess[i]}, "hi");
|
log.info({res: bogusRess[i]}, 'hi');
|
||||||
t.equal(records[i].res, bogusRess[i]);
|
t.equal(records[i].res, bogusRess[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ test('res serializer', function (t) {
|
||||||
res.end('Hello World\n');
|
res.end('Hello World\n');
|
||||||
})
|
})
|
||||||
server.listen(8765, function () {
|
server.listen(8765, function () {
|
||||||
http.get({host: '127.0.0.1', port: 8765, path: '/'}, function(res) {
|
http.get({host: '127.0.0.1', port: 8765, path: '/'}, function (res) {
|
||||||
res.resume();
|
res.resume();
|
||||||
log.info({res: theRes}, 'the response');
|
log.info({res: theRes}, 'the response');
|
||||||
var lastRecord = records[records.length-1];
|
var lastRecord = records[records.length-1];
|
||||||
|
@ -162,11 +162,11 @@ test('err serializer', function (t) {
|
||||||
{},
|
{},
|
||||||
1,
|
1,
|
||||||
'string',
|
'string',
|
||||||
[1,2,3],
|
[1, 2, 3],
|
||||||
{'foo':'bar'}
|
{'foo':'bar'}
|
||||||
];
|
];
|
||||||
for (var i = 0; i < bogusErrs.length; i++) {
|
for (var i = 0; i < bogusErrs.length; i++) {
|
||||||
log.info({err: bogusErrs[i]}, "hi");
|
log.info({err: bogusErrs[i]}, 'hi');
|
||||||
t.equal(records[i].err, bogusErrs[i]);
|
t.equal(records[i].err, bogusErrs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,10 +185,10 @@ test('err serializer: long stack', function (t) {
|
||||||
var records = [];
|
var records = [];
|
||||||
var log = bunyan.createLogger({
|
var log = bunyan.createLogger({
|
||||||
name: 'serializer-test',
|
name: 'serializer-test',
|
||||||
streams: [{
|
streams: [ {
|
||||||
stream: new CapturingStream(records),
|
stream: new CapturingStream(records),
|
||||||
type: 'raw'
|
type: 'raw'
|
||||||
}],
|
} ],
|
||||||
serializers: {
|
serializers: {
|
||||||
err: bunyan.stdSerializers.err
|
err: bunyan.stdSerializers.err
|
||||||
}
|
}
|
||||||
|
@ -269,10 +269,10 @@ test('do not apply serializers if no record key', function (t) {
|
||||||
var records = [];
|
var records = [];
|
||||||
var log = bunyan.createLogger({
|
var log = bunyan.createLogger({
|
||||||
name: 'serializer-test',
|
name: 'serializer-test',
|
||||||
streams: [{
|
streams: [ {
|
||||||
stream: new CapturingStream(records),
|
stream: new CapturingStream(records),
|
||||||
type: 'raw'
|
type: 'raw'
|
||||||
}],
|
} ],
|
||||||
serializers: {
|
serializers: {
|
||||||
err: bunyan.stdSerializers.err,
|
err: bunyan.stdSerializers.err,
|
||||||
boom: function (value) {
|
boom: function (value) {
|
||||||
|
|
Loading…
Reference in a new issue