go-latestver/internal/helpers/log.go
Knut Ahlers 9255fc6898
Lint: Update linter config, fix all linter issues
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-03-18 17:57:13 +01:00

15 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...)
}