From 4dd8bae5c91fa4aef09d865d8fef1acd84f90925 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 17 Oct 2021 00:47:22 +0200 Subject: Update dependencies (#1610) * Update dependencies * Update module to go 1.17 --- vendor/github.com/apex/log/context.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vendor/github.com/apex/log/context.go (limited to 'vendor/github.com/apex/log/context.go') diff --git a/vendor/github.com/apex/log/context.go b/vendor/github.com/apex/log/context.go new file mode 100644 index 00000000..290ae414 --- /dev/null +++ b/vendor/github.com/apex/log/context.go @@ -0,0 +1,19 @@ +package log + +import "context" + +// logKey is a private context key. +type logKey struct{} + +// NewContext returns a new context with logger. +func NewContext(ctx context.Context, v Interface) context.Context { + return context.WithValue(ctx, logKey{}, v) +} + +// FromContext returns the logger from context, or log.Log. +func FromContext(ctx context.Context) Interface { + if v, ok := ctx.Value(logKey{}).(Interface); ok { + return v + } + return Log +} -- cgit v1.2.3