fix(log): segmentation violation when err is nil

This commit is contained in:
Siyuan Miao 2025-04-11 18:49:08 +02:00
parent 87ee954e70
commit edca8a4cb5
1 changed files with 4 additions and 0 deletions

4
log.go
View File

@ -206,6 +206,10 @@ func ErrorfL(l *zerolog.Logger, format string, err error, args ...interface{}) e
l.Error().Err(err).Msgf(format, args...)
if err == nil {
return fmt.Errorf(format, args...)
}
err_msg := err.Error() + ": %v"
err_args := append(args, err)