return early

This makes it easier to read / understand and is more idiomatic.
This commit is contained in:
Edward Muller 2019-09-05 16:09:16 -07:00
parent de736cf91b
commit 60320cbc2c
No known key found for this signature in database
GPG Key ID: FC5833DB021899A5
1 changed files with 4 additions and 5 deletions

View File

@ -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)
}
}