refactor: resolve error type from error

This commit is contained in:
franklin 2021-05-26 10:02:21 +02:00
parent 85deceec62
commit 0ec788f20b

View File

@ -1,6 +1,8 @@
package log package log
import ( import (
"reflect"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -14,8 +16,8 @@ func FError(err error) zap.Field {
return zap.NamedError(ErrorMessageKey, err) return zap.NamedError(ErrorMessageKey, err)
} }
func FErrorType(errType string) zap.Field { func FErrorType(err error) zap.Field {
return zap.String(ErrorTypeKey, errType) return zap.String(ErrorTypeKey, reflect.TypeOf(err).String())
} }
func FStackSkip(skip int) zap.Field { func FStackSkip(skip int) zap.Field {