diff --git a/TODO.md b/TODO.md index 1a7d181..96db861 100644 --- a/TODO.md +++ b/TODO.md @@ -4,6 +4,7 @@ require: facility and hostname + line/file: possible to get quickly with v8? - bunyan cli: more layouts (http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html) - bunyan cli: filter args a la json - bunyan cli: -c COND args a la json diff --git a/bin/bunyan b/bin/bunyan index 593ea0d..9ab1c8d 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -274,17 +274,14 @@ function handleLogLine(line, opts) { } var levelStr = (upperNameFromLevel[rec.level] || ""); - var extras = [ - rec.request_id || "" - ]; - if (rec.latency) { - extras.push(rec.latency + "ms"); - } - extras = extras.join(', ') + var extras = []; + if (rec.request_id) extras.push(rec.request_id); + if (rec.latency) extras.push(rec.latency + "ms"); + extras = (extras.length ? ' (' + extras.join(', ') + ')' : ''); if (rec.msg.indexOf('\n') !== -1) { XXX } else { - emit(format("[%s] %s: %s on %s: %s (%s)\n", + emit(format("[%s] %s: %s on %s: %s%s\n", rec.time, upperNameFromLevel[rec.level] || "", svc, diff --git a/examples/multi.js b/examples/multi.js index cbb3c3f..7a1589d 100644 --- a/examples/multi.js +++ b/examples/multi.js @@ -9,7 +9,6 @@ log = new Logger({ { level: "error", path: "tmp/error.log" - // when to close file stream? } ] });