geck-go/logging/helpers.go
2021-12-02 09:16:01 +01:00

23 lines
357 B
Go

package logging
import (
"github.com/rs/zerolog/log"
)
// FatalOnErr logs the error, if not nil, with fatal level.
func FatalOnErr(err error) {
if err != nil {
log.Fatal().
Err(err).
Send()
}
}
// PanicOnErr logs the error, if not nil, with panic level.
func PanicOnErr(err error) {
if err != nil {
log.Panic().
Err(err).
Send()
}
}