MCPcopy
hub / github.com/rs/zerolog / Interface

Method Interface

event.go:825–834  ·  view source on GitHub ↗

Interface adds the field key with i marshaled using reflection.

(key string, i interface{})

Source from the content-addressed store, hash-verified

823
824// Interface adds the field key with i marshaled using reflection.
825func (e *Event) Interface(key string, i interface{}) *Event {
826 if e == nil {
827 return e
828 }
829 if obj, ok := i.(LogObjectMarshaler); ok {
830 return e.Object(key, obj)
831 }
832 e.buf = enc.AppendInterface(enc.AppendKey(e.buf, key), i)
833 return e
834}
835
836// Type adds the field key with val's type using reflection.
837func (e *Event) Type(key string, val interface{}) *Event {

Callers 15

AnErrMethod · 0.95
ErrMethod · 0.95
AnyMethod · 0.95
TestEvent_WithNilEventFunction · 0.95
ExampleEvent_InterfaceFunction · 0.45
ExampleContext_InterfaceFunction · 0.45
TestWithFunction · 0.45
TestFieldsDisabledFunction · 0.45
TestHTMLNoEscapingFunction · 0.45
TestArrayFunction · 0.45
ExampleEvent_InterfaceFunction · 0.45
ExampleContext_InterfaceFunction · 0.45

Calls 3

ObjectMethod · 0.95
AppendInterfaceMethod · 0.65
AppendKeyMethod · 0.65

Tested by 15

TestEvent_WithNilEventFunction · 0.76
ExampleEvent_InterfaceFunction · 0.36
ExampleContext_InterfaceFunction · 0.36
TestWithFunction · 0.36
TestFieldsDisabledFunction · 0.36
TestHTMLNoEscapingFunction · 0.36
TestArrayFunction · 0.36
ExampleEvent_InterfaceFunction · 0.36
ExampleContext_InterfaceFunction · 0.36
TestConsoleWriterFunction · 0.36
BenchmarkLogFieldTypeFunction · 0.36