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

Method Str

event.go:315–321  ·  event.go::Event.Str

Str adds the field key with val as a string to the *Event context.

(key, val string)

Source from the content-addressed store, hash-verified

313
314// Str adds the field key with val as a string to the *Event context.
315func (e *Event) Str(key, val string) *Event {
316 if e == nil {
317 return e
318 }
319 e.buf = enc.AppendString(enc.AppendKey(e.buf, key), val)
320 return e
321}
322
323// Strs adds the field key with vals as a []string to the *Event context.
324//

Callers 15

AnErrMethod · 0.95
ErrMethod · 0.95
TestEvent_WithNilEventFunction · 0.95
ExampleLogger_WithFunction · 0.45
RunMethod · 0.45
RunMethod · 0.45
ExampleLogger_TraceFunction · 0.45
ExampleLogger_DebugFunction · 0.45
ExampleLogger_InfoFunction · 0.45
ExampleLogger_WarnFunction · 0.45
ExampleLogger_WriteFunction · 0.45
ExampleLogger_LogFunction · 0.45

Calls 2

AppendStringMethod · 0.65
AppendKeyMethod · 0.65

Tested by 15

TestEvent_WithNilEventFunction · 0.76
ExampleLogger_WithFunction · 0.36
RunMethod · 0.36
RunMethod · 0.36
ExampleLogger_TraceFunction · 0.36
ExampleLogger_DebugFunction · 0.36
ExampleLogger_InfoFunction · 0.36
ExampleLogger_WarnFunction · 0.36
ExampleLogger_WriteFunction · 0.36
ExampleLogger_LogFunction · 0.36
ExampleEvent_DictFunction · 0.36
MarshalZerologObjectMethod · 0.36