Lock the writer for the logger to prevent a race condition when used from multiple goroutines

pull/9056/head
Jonathan A. Sternberg 2018-02-14 14:03:50 -05:00
parent 2bb5b68833
commit d864c7e857
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ func (c *Config) New(defaultOutput io.Writer) (*zap.Logger, error) {
}
return zap.New(zapcore.NewCore(
encoder,
zapcore.AddSync(w),
zapcore.Lock(zapcore.AddSync(w)),
c.Level,
)), nil
}