mirror of
https://github.com/Luzifer/go-latestver.git
synced 2024-11-09 23:50:05 +00:00
14 lines
341 B
Go
14 lines
341 B
Go
// Package helpers contains helper functions to avoid code duplication
|
|
package helpers
|
|
|
|
import "github.com/sirupsen/logrus"
|
|
|
|
// LogIfErr yields a logrus error log line when the given error is
|
|
// not nil
|
|
func LogIfErr(err error, msgTpl string, params ...any) {
|
|
if err == nil {
|
|
return
|
|
}
|
|
|
|
logrus.WithError(err).Errorf(msgTpl, params...)
|
|
}
|