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

Method Caller

event.go:858–864  ·  view source on GitHub ↗

Caller adds the file:line of the caller with the zerolog.CallerFieldName key. The argument skip is the number of stack frames to ascend Skip If not passed, use the global variable CallerSkipFrameCount

(skip ...int)

Source from the content-addressed store, hash-verified

856// The argument skip is the number of stack frames to ascend
857// Skip If not passed, use the global variable CallerSkipFrameCount
858func (e *Event) Caller(skip ...int) *Event {
859 sk := CallerSkipFrameCount
860 if len(skip) > 0 {
861 sk = skip[0] + CallerSkipFrameCount
862 }
863 return e.caller(sk)
864}
865
866func (e *Event) caller(skip int) *Event {
867 if e == nil {

Callers 7

TestEvent_WithNilEventFunction · 0.95
TestWithFunction · 0.45
TestFieldsFunction · 0.45
TestCallerMarshalFuncFunction · 0.45
callerMethod · 0.45
WriteMethod · 0.45

Calls 1

callerMethod · 0.95

Tested by 5

TestEvent_WithNilEventFunction · 0.76
TestWithFunction · 0.36
TestFieldsFunction · 0.36
TestCallerMarshalFuncFunction · 0.36