Skip to content

Commit

Permalink
return early
Browse files Browse the repository at this point in the history
This makes it easier to read / understand and is more idiomatic.
  • Loading branch information
Edward Muller committed Sep 5, 2019
1 parent de736cf commit 60320cb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,10 @@ func (entry *Entry) write() {
serialized, err := entry.Logger.Formatter.Format(entry)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
} else {
_, err = entry.Logger.Out.Write(serialized)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
}
return
}
if _, err = entry.Logger.Out.Write(serialized); err != nil {
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
}
}

Expand Down

0 comments on commit 60320cb

Please sign in to comment.