`bunyan -c COND` is broken #61

Closed
trentm opened this Issue Nov 29, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@trentm
Owner

trentm commented Nov 29, 2012

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

Noted on trentm/json#34 (comment)

@ghost ghost assigned trentm Nov 29, 2012

@trentm trentm referenced this issue in trentm/json Nov 29, 2012

Closed

'json -g -a' should stream #34

@trentm

This comment has been minimized.

Show comment
Hide comment
@trentm

trentm Dec 2, 2012

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
Owner

trentm commented Dec 2, 2012

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 Dec 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment