Documentation ¶
Index ¶
- func Cause(err error) error
- func FieldRequest(key string, r *http.Request) zap.Field
- func Fields(err error) []zap.Field
- type Error
- func (e *Error) Cause() error
- func (e *Error) Error() string
- func (e *Error) Fields() []zap.Field
- func (e *Error) LogDPanic(logger *zap.Logger)
- func (e *Error) LogDebug(logger *zap.Logger)
- func (e *Error) LogError(logger *zap.Logger)
- func (e *Error) LogFatal(logger *zap.Logger)
- func (e *Error) LogInfo(logger *zap.Logger)
- func (e *Error) LogPanic(logger *zap.Logger)
- func (e *Error) LogWarn(logger *zap.Logger)
- func (e *Error) Unwrap() error
- func (e *Error) WithAny(key string, value interface{}) *Error
- func (e *Error) WithArray(key string, val zapcore.ArrayMarshaler) *Error
- func (e *Error) WithBinary(key string, val []byte) *Error
- func (e *Error) WithBool(key string, val bool) *Error
- func (e *Error) WithBools(key string, bs []bool) *Error
- func (e *Error) WithByteString(key string, val []byte) *Error
- func (e *Error) WithByteStrings(key string, bss [][]byte) *Error
- func (e *Error) WithComplex128(key string, val complex128) *Error
- func (e *Error) WithComplex128s(key string, nums []complex128) *Error
- func (e *Error) WithComplex64(key string, val complex64) *Error
- func (e *Error) WithComplex64s(key string, nums []complex64) *Error
- func (e *Error) WithDuration(key string, val time.Duration) *Error
- func (e *Error) WithDurations(key string, ds []time.Duration) *Error
- func (e *Error) WithError(err error) *Error
- func (e *Error) WithErrors(key string, errs []error) *Error
- func (e *Error) WithField(f zap.Field, additionalFields ...zap.Field) *Error
- func (e *Error) WithFloat32(key string, val float32) *Error
- func (e *Error) WithFloat32s(key string, nums []float32) *Error
- func (e *Error) WithFloat64(key string, val float64) *Error
- func (e *Error) WithFloat64s(key string, nums []float64) *Error
- func (e *Error) WithInt(key string, val int) *Error
- func (e *Error) WithInt16(key string, val int16) *Error
- func (e *Error) WithInt16s(key string, nums []int16) *Error
- func (e *Error) WithInt32(key string, val int32) *Error
- func (e *Error) WithInt32s(key string, nums []int32) *Error
- func (e *Error) WithInt64(key string, val int64) *Error
- func (e *Error) WithInt64s(key string, nums []int64) *Error
- func (e *Error) WithInt8(key string, val int8) *Error
- func (e *Error) WithInt8s(key string, nums []int8) *Error
- func (e *Error) WithInts(key string, nums []int) *Error
- func (e *Error) WithNamedError(key string, err error) *Error
- func (e *Error) WithNamespace(key string) *Error
- func (e *Error) WithObject(key string, val zapcore.ObjectMarshaler) *Error
- func (e *Error) WithReflect(key string, val interface{}) *Error
- func (e *Error) WithRequest(r *http.Request) *Error
- func (e *Error) WithSkip() *Error
- func (e *Error) WithStack(key string) *Error
- func (e *Error) WithString(key string, val string) *Error
- func (e *Error) WithStringer(key string, val fmt.Stringer) *Error
- func (e *Error) WithStrings(key string, ss []string) *Error
- func (e *Error) WithTime(key string, val time.Time) *Error
- func (e *Error) WithTimes(key string, ts []time.Time) *Error
- func (e *Error) WithUint(key string, val uint) *Error
- func (e *Error) WithUint16(key string, val uint16) *Error
- func (e *Error) WithUint16s(key string, nums []uint16) *Error
- func (e *Error) WithUint32(key string, val uint32) *Error
- func (e *Error) WithUint32s(key string, nums []uint32) *Error
- func (e *Error) WithUint64(key string, val uint64) *Error
- func (e *Error) WithUint64s(key string, nums []uint64) *Error
- func (e *Error) WithUint8(key string, val uint8) *Error
- func (e *Error) WithUint8s(key string, nums []uint8) *Error
- func (e *Error) WithUintptr(key string, val uintptr) *Error
- func (e *Error) WithUintptrs(key string, us []uintptr) *Error
- func (e *Error) WithUints(key string, nums []uint) *Error
- type Header
- type Request
- type StringArray
- type URLValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldRequest ¶
FieldRequest converts a http request to a zap request, which is compatible with the zap ObjectMarshaler interface
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is the type used to wrap other errors with additional fields
func Sugar ¶
Sugar is a sugared version of the 'Wrap' function above. It allows the user to add fields without using strongly typed fields, e.g. errors.Wraps(err, "key-1", 12, "key-2", "some string", "key-3", value)
func SugarNoStack ¶
SugarNoStack is exactly like the 'Sugar' function but without an additional stacktrace
func WrapNoStack ¶
WrapNoStack wraps error with fields, but always excludes the stack trace
func (*Error) Cause ¶
Cause returns the cause of this error Note that Unwrap should be used, this is included for compatibility with pkg/errors
func (*Error) Fields ¶
Fields returns all fields attached to this error, and all fields attached to previous errors
func (*Error) WithComplex128 ¶
func (e *Error) WithComplex128(key string, val complex128) *Error
func (*Error) WithComplex128s ¶
func (e *Error) WithComplex128s(key string, nums []complex128) *Error
func (*Error) WithField ¶
WithField creates a new Error instance, with one or more fields added. Note that this is equivalent to calling WrapNoStack(err, f)
func (*Error) WithNamespace ¶
func (*Error) WithObject ¶
func (e *Error) WithObject(key string, val zapcore.ObjectMarshaler) *Error
func (*Error) WithReflect ¶
func (*Error) WithRequest ¶
WithRequest adds information about a http request to the given error. This is a convenience function that performs the same task as calling
err.WithField(zerr.FieldRequest("request", r))
or
WrapNoStack(err, zerr.FieldRequest("request", r))
type Header ¶
Header is a wrapper around http.Header that implements zapcore.ObjectMarshaler
func (Header) MarshalLogObject ¶
func (h Header) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
MarshalLogObject encodes headers with a zapcore.ObjectEncoder
type Request ¶
Request is a wrapper around http.Request that implements zapcore.ObjectMarshaler
func (*Request) MarshalLogObject ¶
func (r *Request) MarshalLogObject(enc zapcore.ObjectEncoder) error
MarshalLogObject encodes request with a zapcore.ObjectEncoder
type StringArray ¶
type StringArray []string
StringArray is an array of strings that implements zapcore.ArrayMarshaler
func (StringArray) MarshalLogArray ¶
func (a StringArray) MarshalLogArray(enc zapcore.ArrayEncoder) error
MarshalLogArray encodes an array of strings with a zapcore.ArrayEncoder
type URLValues ¶
URLValues is a wrapper around url.Values that implements zapcore.ObjectMarshaler
func (URLValues) MarshalLogObject ¶
func (values URLValues) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)
MarshalLogObject encodes url values with a zapcore.ObjectEncoder