diff --git a/TODO.md b/TODO.md index 0388d4d..3e82793 100644 --- a/TODO.md +++ b/TODO.md @@ -20,6 +20,7 @@ as the basis for tools to consume bunyan logs. It can grow indep of node-bunyan for generating the logs. It would take a Bunyan log record object and be expected to emit it. +- document "well-known" keys from bunyan CLI p.o.v.. Add "client_req". diff --git a/bin/bunyan b/bin/bunyan index 955be03..fd03e3a 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -332,6 +332,23 @@ function handleLogLine(line, opts) { } delete rec.req; + if (rec.client_req) { + var headers = rec.client_req.headers; + var hostHeaderLine = ''; + if (rec.client_req.address) { + hostHeaderLine = 'Host: ' + rec.client_req.address; + if (rec.client_req.port) + hostHeaderLine += ':' + rec.client_req.port; + hostHeaderLine += '\n'; + } + details.push(indent(format("%s %s HTTP/1.1\n%s%s", rec.client_req.method, + rec.client_req.url, + hostHeaderLine, + Object.keys(headers).map( + function (h) { return h + ': ' + headers[h]}).join('\n')))); + } + delete rec.client_req; + if (rec.res) { var s = ''; if (rec.res.header) {