Skip to content

Commit 71fd238

Browse files
committed
log: Return from Error if err is nil
It doesn't make sense to log something as an error if the error is nil and therefore there is no error.
1 parent 8e2e62d commit 71fd238

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

log/log.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ func (l Logger) Close() {
103103
// All the values of arg are stringified and concatenated without any strings.
104104
// If no args are provided err.Error() is used as the log message.
105105
func (l Logger) Error(err error, args ...interface{}) {
106+
if err == nil {
107+
return
108+
}
106109
if ok := os.Getenv("ROLLBAR_TOKEN"); ok != "" {
107110
rollbar.Notify(err, args)
108111
}

0 commit comments

Comments
 (0)