Skip to content

Commit

Permalink
Simplify check for writing errors to ErrorOutput (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
lancoLiu committed Jul 30, 2021
1 parent 1cac10b commit 81879d1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions zapcore/entry.go
Expand Up @@ -219,11 +219,9 @@ func (ce *CheckedEntry) Write(fields ...Field) {
for i := range ce.cores {
err = multierr.Append(err, ce.cores[i].Write(ce.Entry, fields))
}
if ce.ErrorOutput != nil {
if err != nil {
fmt.Fprintf(ce.ErrorOutput, "%v write error: %v\n", ce.Time, err)
ce.ErrorOutput.Sync()
}
if err != nil && ce.ErrorOutput != nil {
fmt.Fprintf(ce.ErrorOutput, "%v write error: %v\n", ce.Time, err)
ce.ErrorOutput.Sync()
}

should, msg := ce.should, ce.Message
Expand Down

0 comments on commit 81879d1

Please sign in to comment.