Use current json.Poster in sdk, which uses stdout#624
Merged
carlosms merged 1 commit intosrc-d:masterfrom Apr 18, 2019
Merged
Conversation
json.Poster writes the comments in json format over the passed io.Writter so if using os.Stdout comments will be written in stdout, and logs in stderr Signed-off-by: David Pordomingo <David.Pordomingo.F@gmail.com>
carlosms
approved these changes
Apr 9, 2019
se7entyse7en
approved these changes
Apr 9, 2019
smacker
approved these changes
Apr 10, 2019
Contributor
smacker
left a comment
There was a problem hiding this comment.
@dpordomingo do you mind to create issues for the improvements we discussed?
Contributor
|
I would also prefer to add |
Contributor
|
Yeah, it would be nice if you could find out why |
Contributor
Author
Contributor
|
I took a look and the I think we can merge this one and add an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #601
json.Posterwrites the comments in json format into the passedio.Writterso if using
os.Stdout, comments will be written instdout, and logs instderrThen comments and logs can be separated:
Click to see `log.err`, where `stderr` was redirected:
$ cat log.err {"app":"lookout-sdk","level":"info","msg":"resolving to/from references","time":"2019-04-09T11:13:08.194352331+02:00"} {"app":"lookout-sdk","level":"info","msg":"starting looking for Analyzer at ipv4://localhost:9930","time":"2019-04-09T11:13:08.196105525+02:00"} {"app":"lookout-sdk","level":"info","msg":"starting a DataServer at ipv4://localhost:10301","time":"2019-04-09T11:13:08.196239204+02:00"} {"addr":"localhost:9432","app":"lookout-sdk","level":"info","msg":"connection state changed to 'IDLE'","name":"bblfsh-proxy","time":"2019-04-09T11:13:08.196725494+02:00"} {"addr":"localhost:9432","app":"lookout-sdk","level":"info","msg":"connection state changed to 'CONNECTING'","name":"bblfsh-proxy","time":"2019-04-09T11:13:08.196821332+02:00"} {"app":"lookout-sdk","level":"info","msg":"processing pull request","provider":"","time":"2019-04-09T11:13:08.197346984+02:00"} {"addr":"localhost:9432","app":"lookout-sdk","level":"info","msg":"connection state changed to 'READY'","name":"bblfsh-proxy","time":"2019-04-09T11:13:08.197541946+02:00"} {"app":"lookout-sdk","config-file":"repository .lookout.yml","level":"warning","msg":"analyzer 'Dummy' required by configuration file isn't enabled on server","provider":"","time":"2019-04-09T11:13:08.200001107+02:00"} {"app":"lookout-sdk","config-file":"repository .lookout.yml","level":"warning","msg":"analyzer 'gometalint-analyzer' required by configuration file isn't enabled on server","provider":"","time":"2019-04-09T11:13:08.200028102+02:00"} {"app":"lookout-sdk","level":"info","msg":"New status","provider":"","status":3,"time":"2019-04-09T11:13:08.200052838+02:00"} {"analyzer":"test-analyzer","app":"lookout-sdk","grpc.method":"NotifyReviewEvent","grpc.service":"pb.Analyzer","level":"info","msg":"gRPC unary client call started","provider":"","span.kind":"client","system":"grpc","time":"2019-04-09T11:13:08.200125721+02:00"} {"analyzer":"test-analyzer","app":"lookout-sdk","grpc.method":"GetChanges","grpc.service":"pb.Data","level":"info","msg":"gRPC streaming server call started","provider":"","span.kind":"server","system":"grpc","time":"2019-04-09T11:13:14.772033431+02:00"} {"analyzer":"test-analyzer","app":"lookout-sdk","duration":119246660,"grpc.code":0,"grpc.method":"GetChanges","grpc.service":"pb.Data","grpc.start_time":"2019-04-09T11:13:14+02:00","level":"info","msg":"gRPC streaming server call finished","provider":"","span.kind":"server","system":"grpc","time":"2019-04-09T11:13:14.891535334+02:00"} {"analyzer":"test-analyzer","app":"lookout-sdk","duration":6692246859,"grpc.code":0,"grpc.method":"NotifyReviewEvent","grpc.service":"pb.Analyzer","grpc.start_time":"2019-04-09T11:13:08+02:00","level":"info","msg":"gRPC unary client call finished","provider":"","span.kind":"client","system":"grpc","time":"2019-04-09T11:13:14.892412722+02:00"} {"app":"lookout-sdk","comments":5,"level":"info","msg":"posting analysis","provider":"","time":"2019-04-09T11:13:14.892496472+02:00"} {"app":"lookout-sdk","level":"info","msg":"New status","provider":"","status":4,"time":"2019-04-09T11:13:14.892988574+02:00"}And it also works if the logs are requested to be human readable:
Click to see `log.err`, where `stderr` was redirected: