From 71e5d1be25312e2560bc967cbd59f6fe6dc424fe Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 28 May 2014 23:35:56 -0700 Subject: [PATCH] note aexmachina's change, style tweaks for make check --- AUTHORS | 1 + CHANGES.md | 3 +++ bin/bunyan | 6 ++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 777589b..65b5f6d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Isaac Schlueter (https://github.com/isaacs) Rob Gulewich (https://github.com/rgulewich) Bryan Cantrill (https://github.com/bcantrill) Michael Hart (https://github.com/mhart) +Simon Wade (https://github.com/aexmachina) diff --git a/CHANGES.md b/CHANGES.md index d706905..3c5e7ec 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,9 @@ Known issues: ## bunyan 0.23.0 (not yet released) +- [pull #42] Fix `bunyan` crash on a log record with `req.headers` that is a *string* + (by https://github.com/aexmachina). + - Drop node 0.6 support. I can't effectively `npm install` with a node 0.6 anymore. diff --git a/bin/bunyan b/bin/bunyan index bf1040f..41241aa 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -756,11 +756,9 @@ function emitRecord(rec, line, opts, stylize) { var headers = req.headers; if (!headers) { headers = ''; - } - else if (typeof headers === 'string') { + } else if (typeof (headers) === 'string') { headers = '\n' + headers; - } - else if (typeof headers === 'object') { + } else if (typeof (headers) === 'object') { headers = '\n' + Object.keys(headers).map(function (h) { return h + ': ' + headers[h]; }).join('\n');