24 lines
357 B
Go
24 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()
|
||
|
}
|
||
|
}
|