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

remove WriteSyncer's automatic lock #369

Merged
merged 3 commits into from
Mar 14, 2017
Merged

Conversation

flisky
Copy link
Contributor

@flisky flisky commented Mar 13, 2017

The lock goes up to function call to make changes compatible.

And now, it's user's duty to make WriteSyncer concurrent-safe.

Fix up #359.

@seifer
Copy link

seifer commented Mar 13, 2017

Ok, the same question as in #359. When will this be merged? :)

@akshayjshah
Copy link
Contributor

akshayjshah commented Mar 13, 2017

Thanks for opening a second PR! This goes further than what I'd intended; I'm going to push a commit to back out some of these changes.

writer.go Outdated
@@ -81,5 +81,5 @@ func CombineWriteSyncers(writers ...zapcore.WriteSyncer) zapcore.WriteSyncer {
if len(writers) == 0 {
return zapcore.AddSync(ioutil.Discard)
}
return zapcore.Lock(zapcore.NewMultiWriteSyncer(writers...))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to keep this auto-lock, since it lets users easily replicate the behavior of the Config struct. In general, I'd like the zapcore package to have no defaults and the zap package to supply sane defaults.

Anyone who doesn't want this auto-locking can just use zapcore.NewMultiWriteSyncer.

options.go Outdated
@@ -63,7 +63,7 @@ func Fields(fs ...zapcore.Field) Option {
// safe for concurrent use.
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to update the comment here.

The lock goes up to function call to make changes compatible.

And now, it's user's duty to make WriteSyncer concurrent-safe.
@akshayjshah akshayjshah merged commit 74ca5ef into uber-go:master Mar 14, 2017
@flisky flisky deleted the remove-lock branch March 15, 2017 07:29
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.

5 participants