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

Method GetCtx

event.go:510–515  ·  view source on GitHub ↗

GetCtx retrieves the Go context.Context which is optionally stored in the Event. This allows Hooks and functions passed to Func() to retrieve values which are stored in the context.Context. This can be useful in tracing, where span information is commonly propagated in the context.Context.

()

Source from the content-addressed store, hash-verified

508// which are stored in the context.Context. This can be useful in tracing,
509// where span information is commonly propagated in the context.Context.
510func (e *Event) GetCtx() context.Context {
511 if e == nil || e.ctx == nil {
512 return context.Background()
513 }
514 return e.ctx
515}
516
517// Bool adds the field key with val as a bool to the *Event context.
518func (e *Event) Bool(key string, b bool) *Event {

Callers 4

hook_test.goFile · 0.80
TestEvent_ObjectFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestEvent_ObjectFunction · 0.64