objects

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeFieldInterface

func EncodeFieldInterface(enc zapcore.ObjectEncoder, field zap.Field) error

EncodeFieldInterface is a proxy between the zap field and the encoder, determining the appropriate representation of each field value

func HTTPECSMapper

func HTTPECSMapper(field zap.Field, object *HTTPMarshalObject)

func IsNilValue

func IsNilValue(v interface{}) bool

IsNilValue performs a panic safe nil check on v, including embedded interface values

func IsUnmarshalableValue

func IsUnmarshalableValue(v interface{}) bool

IsUnmarshalableValue performs a panic safe basic type and value assertion on v to check if it is apt for Unmarshal operations (that is, a non nil pointer value)

Types

type HTTPBodyMarshalObject

type HTTPBodyMarshalObject struct {
	BodyContent string `json:"content,omitempty"`
	Headers     string `json:"headers,omitempty"`
	StatusCode  string `json:"status_code,omitempty"`
}

type HTTPMarshalObject

type HTTPMarshalObject struct {
	Request  *HTTPRequestMarshalObject  `json:"request,omitempty"`
	Response *HTTPResponseMarshalObject `json:"response,omitempty"`
}

type HTTPObject

type HTTPObject struct {
	// contains filtered or unexported fields
}

HTTPObject is a specialized nested struct which transforms into a serialized field

func NestedObject

func NestedObject(baseKey string, mapper func(zap.Field, *HTTPMarshalObject), fields ...zap.Field) *HTTPObject

func (*HTTPObject) AsField

func (f *HTTPObject) AsField() zap.Field

func (*HTTPObject) MarshalJSON

func (f *HTTPObject) MarshalJSON() ([]byte, error)

func (*HTTPObject) MarshalLogObject

func (f *HTTPObject) MarshalLogObject(enc zapcore.ObjectEncoder) error

type HTTPRequestMarshalObject

type HTTPRequestMarshalObject struct {
	Body            *HTTPBodyMarshalObject `json:"body,omitempty"`
	RequestMethod   string                 `json:"method,omitempty"`
	RequestReferrer string                 `json:"referrer,omitempty"`
}

type HTTPResponseMarshalObject

type HTTPResponseMarshalObject struct {
	Body             *HTTPBodyMarshalObject `json:"body,omitempty"`
	ResponseReferrer string                 `json:"referrer,omitempty"`
}

type Object

type Object struct {
	// contains filtered or unexported fields
}

Object is a field wrapper which encodes them into a plain, key/value struct upon marshal

func AsObject

func AsObject(fields ...zap.Field) *Object

func (*Object) MarshalLogObject

func (f *Object) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject marshals the object as required by the zap serializer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL