geck-go/logging/helpers.go

24 lines
357 B
Go
Raw Normal View History

2021-12-01 19:22:07 +00:00
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()
}
}