-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add log package #54
Add log package #54
Conversation
Travis CI build is failing because of In general, I am also not a fan of the I think it's fair to follow the same strategy as |
Ah yea, I can fix that depending on the owner's feelings on this. Yeah, there's a few options out there and it's inconsistent. I've started using my own https://go.pedge.io/protolog for structured logging in github.com/pachyderm/pachyderm (which is the initial reason I did this PR, so that logging would be consistent for the pachyderm repository), but I would go as far to say that most people use github.com/Sirupsen/logrus (including github.com/docker/docker), which this Logger interface is a drop-in for https://godoc.org/github.com/Sirupsen/logrus#Logger. glog is way faster though, for the record...which is why it is nice to have the option :) |
@shurcooL @yugui I put together this https://github.com/peter-edge/go-dlog that might satisfy everyone, this would cover grpc-go too so ping @iamqizhao, we could make this common between both grpc-go and grpc-gateway, which would be a big win. I'll extend the documentation tomorrow morning, but it makes it simple, just `import _ "go.pedge.io/dlog/glog". Thoughts on this? |
Although I'm a fan of I have some comments on implementation details.
|
My hope would be I could get both you and @iamqizhao to agree on a common implementation, and I figured dlog might be a good answer haha :) If you add a Debug level to grpclog, it's basically dlog, but dlog makes it easier to bring in other implementations and provides other functionality (tomorrow morning I'd send a pull request to grpc-go with it for consideration). But honestly it really doesn't matter much to me - dlog clearly only took 30 minutes to put together. Also of note, I've benchmarked glog via proxy on an interface with protolog, and the difference is not measurable as far as I can see. |
I thought I might have commented on this last night: re: the logging levels In dlog (or whatever we go with), we could add something like:
For reference, this is what I'm referring to: https://github.com/peter-edge/go-dlog/blob/master/glog/glog.go This isn't as nice as having the full functionality of glog, but it does make it easier to abstract the logging package away (which is the goal of this PR :) ). |
Closing this PR due to this reason:
and because grpc/grpc-go#341 was closed. |
…ed_api update paginated api
This is probably not ready to merge (but does pass tests), but is more for discussion as to what to do here.
I generally use other log implementations than glog, and others do too. It is nice to be able to choose an alternative logger, so I added a simple interface here for a Logger that takes care of most functionality. Instead of the V system that glog has, if you like this direction, I can add Debugf/Debugln to somewhat take care of that situation.
The package github.com/gengo/grpc-gateway is currently imported in runtime/mux.go, so that glog is still the default. Probably not the best place for this (again, this PR probably needs work, but wanted initial feedback).
Reason for doing *ln: all logging generally does newlines anyways, or handles newlines, so it makes more sense to me. Also this means that my https://github.com/peter-edge/go-protolog/blob/master/protolog.go#L59 Logger is a drop-in, which is what I want to use this for anyways :)
I did a similar thing for https://github.com/grpc/grpc-go in https://github.com/grpc/grpc-go/tree/master/grpclog