Skip to content
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: drop Config.Logger field #6629

Merged
merged 1 commit into from
Oct 12, 2016
Merged

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Oct 11, 2016

Fix #6603.

Instead adds 'SetLogger' to set global logger interface
to avoid unnecessary logger updates.

/cc @heyitsanthony @xiang90 @chzyer

@xiang90
Copy link
Contributor

xiang90 commented Oct 11, 2016

lgtm. this needs to be added into release note. we slightly change the api.

@gyuho
Copy link
Contributor Author

gyuho commented Oct 11, 2016

Ok will include this in the release note.

logger.set(log.New(os.Stderr, "", log.LstdFlags))

// disable client side grpc by default
grpclog.SetLogger(log.New(ioutil.Discard, "", 0))
Copy link
Contributor

@heyitsanthony heyitsanthony Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is racey iirc, that's why this logger thing exists in the first place-- the logger has to override the grpclog at initialization so that any changes to the grpclog go through logger with locking instead of through SetLogger; it should be grpclog.SetLogger(&logger) then only updates through logger.set(l).

logger.l = log.New(io.util.Discard, "", 0))
grpclog.SetLogger(&logger)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heyitsanthony You are right, I forgot about that.

Just fixed and adds more comments with your feedback.

PTAL.

Thanks!

@gyuho gyuho force-pushed the clientv3-logger branch 2 times, most recently from d2bd3a7 to 2cfb392 Compare October 11, 2016 23:26
Fix etcd-io#6603.

Instead adds 'SetLogger' to set global logger interface
to avoid unnecessary logger updates.
@heyitsanthony
Copy link
Contributor

lgtm. the comments are helpful

@gyuho gyuho merged commit 66f945c into etcd-io:master Oct 12, 2016
@gyuho gyuho deleted the clientv3-logger branch October 12, 2016 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants