Skip to content

Loading…

`bunyan -c COND` is broken #61

Closed
trentm opened this Issue · 1 comment

1 participant

@trentm
Owner
$ echo '{"b": 1}' | bunyan -c 'a == 1'
{"b": 1}
$ bunyan --version
bunyan 0.16.8

Noted on trentm/json#34 (comment)

@trentm trentm was assigned
@trentm trentm referenced this issue in trentm/json
Closed

'json -g -a' should stream #34

@trentm
Owner

Uh, wait, that example above doesn't indicate brokenness. Bunyan ignores json lines that aren't full Bunyan records: i.e. those that have the requisite fields (v, level, time, msg, et al).

$ echo '{"b": 1}' | bunyan --strict
$

I.e. that isn't a bunyan log record line.

This shows -c working properly:

$ cat foo.js 
var bunyan = require('./lib/bunyan');
var log = bunyan.createLogger({name: 'foo'});
log.info({a: 1}, 'hi');
log.info({b: 2}, 'hi');
$ node foo.js 
{"name":"foo","hostname":"banana.local","pid":44758,"level":30,"a":1,"msg":"hi","time":"2012-12-02T03:11:40.295Z","v":0}
{"name":"foo","hostname":"banana.local","pid":44758,"level":30,"b":2,"msg":"hi","time":"2012-12-02T03:11:40.296Z","v":0}
$ node foo.js | bunyan
[2012-12-02T03:11:44.255Z]  INFO: foo/44759 on banana.local: hi (a=1)
[2012-12-02T03:11:44.256Z]  INFO: foo/44759 on banana.local: hi (b=2)
$ node foo.js | bunyan -c 'this.a'
[2012-12-02T03:11:48.592Z]  INFO: foo/44761 on banana.local: hi (a=1)
$ bunyan --version
bunyan 0.16.8
@trentm trentm closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.