MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / NewContextWithField

Function NewContextWithField

pkg/log/context.go:29–31  ·  view source on GitHub ↗

NewContextWithField returns a derived context with the given field added to the logger.

(ctx context.Context, k string, v any)

Source from the content-addressed store, hash-verified

27
28// NewContextWithField returns a derived context with the given field added to the logger.
29func NewContextWithField(ctx context.Context, k string, v any) context.Context {
30 return NewContext(ctx, FromContext(ctx).WithField(k, v))
31}
32
33// NewContextWithFields returns a derived context with the given fields added to the logger.
34func NewContextWithFields(ctx context.Context, f Fielder) context.Context {

Callers 15

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
initClusterMethod · 0.92
JoinRequestMethod · 0.92
HomeNSRequestMethod · 0.92
AppSKeyRequestMethod · 0.92
NewFunction · 0.92
NewFunction · 0.92
ConnectMethod · 0.92
LinkGatewayMethod · 0.92
GetConcentratorConfigMethod · 0.92

Calls 3

NewContextFunction · 0.70
FromContextFunction · 0.70
WithFieldMethod · 0.65

Tested by 1

TestContextFunction · 0.68