forked from lug/matterbridge
Update dependencies (#1610)
* Update dependencies * Update module to go 1.17
This commit is contained in:
19
vendor/github.com/apex/log/context.go
generated
vendored
Normal file
19
vendor/github.com/apex/log/context.go
generated
vendored
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user