diff --git a/CHANGES.md b/CHANGES.md index 009535b..16b5a1e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,11 @@ ## bunyan 0.6.3 (not yet released) -(nothing yet) +- `bunyan` cli output: clarify extra fields with quoting if empty or have + spaces. E.g. 'cmd' and 'stderr' in the following: + + [2012-02-12T00:30:43.736Z] INFO: mo-docs/43194 on banana.local: buildDocs results (req_id=185edca2-2886-43dc-911c-fe41c09ec0f5, route=PutDocset, error=null, stderr="", cmd="make docs") + ## bunyan 0.6.2 diff --git a/bin/bunyan b/bin/bunyan index 8643e9d..86d9f95 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -381,11 +381,16 @@ function handleLogLine(line, opts) { var key = leftover[i]; var value = rec[key]; var type = typeof(value); + var stringified = false; if (typeof(value) !== 'string') { value = JSON.stringify(value, null, 2); + stringified = true; } if (value.indexOf('\n') !== -1 || value.length > 50) { details.push(indent(key + ': ' + value)) + } else if (!stringified && (value.indexOf(' ') != -1 || + value.length === 0)) { + extras.push(key + '=' + JSON.stringify(value)) } else { extras.push(key + '=' + value) }