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

Method Stringer

event.go:344–350  ·  view source on GitHub ↗

Stringer adds the field key and a val to the *Event context. If val is not nil, it is added by calling val.String(). If val is nil, it is encoded as null without calling String().

(key string, val fmt.Stringer)

Source from the content-addressed store, hash-verified

342// If val is not nil, it is added by calling val.String().
343// If val is nil, it is encoded as null without calling String().
344func (e *Event) Stringer(key string, val fmt.Stringer) *Event {
345 if e == nil {
346 return e
347 }
348 e.buf = enc.AppendStringer(enc.AppendKey(e.buf, key), val)
349 return e
350}
351
352// Stringers adds the field key with vals to the *Event context.
353// If a val is not nil, it is added by calling val.String().

Callers 7

TestWithFunction · 0.45
TestWithResetFunction · 0.45
TestFieldsFunction · 0.45
TestFieldsDisabledFunction · 0.45
BenchmarkLogFieldTypeFunction · 0.45
testcases.goFile · 0.45

Calls 2

AppendKeyMethod · 0.65
AppendStringerMethod · 0.45

Tested by 6

TestWithFunction · 0.36
TestWithResetFunction · 0.36
TestFieldsFunction · 0.36
TestFieldsDisabledFunction · 0.36
BenchmarkLogFieldTypeFunction · 0.36