Merge pull request #83 from mcavage/master

Support restify 'client_res' in bunyan CLI
This commit is contained in:
Trent Mick 2013-04-04 16:59:30 -07:00
commit 7e0f82727f

View file

@ -1,4 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
// -*- mode: js -*-
// //
// bunyan -- filter and pretty-print JSON logs, like Bunyan logs. // bunyan -- filter and pretty-print JSON logs, like Bunyan logs.
// //
@ -829,9 +830,7 @@ function emitRecord(rec, line, opts, stylize) {
details.push(indent(s)); details.push(indent(s));
} }
if (rec.res && typeof (rec.res) === 'object') { function _res(res) {
var res = rec.res;
delete rec.res;
var s = ''; var s = '';
if (res.header) { if (res.header) {
s += res.header.trimRight(); s += res.header.trimRight();
@ -867,6 +866,15 @@ function emitRecord(rec, line, opts, stylize) {
}); });
} }
if (rec.res && typeof (rec.res) === 'object') {
_res(rec.res);
delete rec.res;
}
if (rec.client_res && typeof (rec.client_res) === 'object') {
_res(rec.client_res);
delete rec.res;
}
if (rec.err && rec.err.stack) { if (rec.err && rec.err.stack) {
details.push(indent(rec.err.stack)); details.push(indent(rec.err.stack));
delete rec.err; delete rec.err;