-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
clientv3: disable client side grpc log #4875
Conversation
I ran some simple code of Before
After
|
) | ||
|
||
func init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user should be able to set logger themselves. (we by default disable gRPC logging)
probably add the logger interface into Config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Will change. Thanks.
070761a
to
4cb191b
Compare
@xiang90 Made the logger configurable. PTAL. Thanks. |
@@ -66,6 +72,8 @@ type Config struct { | |||
|
|||
// TLS holds the client secure credentials, if any. | |||
TLS *tls.Config | |||
|
|||
Logger grpclog.Logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc string?
26627d7
to
271cd81
Compare
@xiang90 Fixed up and added godoc. PTAL. Thanks! |
@@ -180,6 +189,15 @@ func newClient(cfg *Config) (*Client, error) { | |||
client.Watcher = NewWatcher(client) | |||
client.Auth = NewAuth(client) | |||
client.Maintenance = &maintenance{c: client} | |||
if cfg.Logger == nil { | |||
// same as default std logger | |||
client.logger = log.New(ioutil.Discard, "", 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment is not accurate. probably just remove the comment. we should always comment why not what. the code itself is the what part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. Just fixed. Thanks!
271cd81
to
29fccb3
Compare
lgtm |
thanks |
Fix #4811.