clearer output for fields with spaces or empty string in bunyan cli output
This commit is contained in:
parent
38ea7735ef
commit
61ff4030e4
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue