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

Function NewContextWithFields

pkg/log/context.go:34–36  ·  view source on GitHub ↗

NewContextWithFields returns a derived context with the given fields added to the logger.

(ctx context.Context, f Fielder)

Source from the content-addressed store, hash-verified

32
33// NewContextWithFields returns a derived context with the given fields added to the logger.
34func NewContextWithFields(ctx context.Context, f Fielder) context.Context {
35 return NewContext(ctx, FromContext(ctx).WithFields(f))
36}
37
38// FromContext returns the logger that is attached to the context or returns the Noop logger if it does not exist
39func FromContext(ctx context.Context) Interface {

Callers 15

publishUplinkMethod · 0.92
forwarderPublisherMethod · 0.92
subscribeDownlinkMethod · 0.92
handleDownlinkMethod · 0.92
subscribeUplinkMethod · 0.92
handleUplinkMethod · 0.92
publishDownlinkMethod · 0.92
homeNetworkPublisherMethod · 0.92
handleConnectionInfoMethod · 0.92
handleTrafficMethod · 0.92
GetRouterConfigMethod · 0.92
DownlinkQueueReplaceMethod · 0.92

Calls 3

NewContextFunction · 0.70
FromContextFunction · 0.70
WithFieldsMethod · 0.65

Tested by 1

TestContextFunction · 0.68