-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
Ok, the same question as in #359. When will this be merged? :) |
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. |
1474f21
to
f2a590e
Compare
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...)) |
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.
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. |
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.
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.
f2a590e
to
35bc23e
Compare
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.