[VOL-1386] This commit add "dep" as the package management tool
for voltha-go.
Change-Id: I52bc4911dd00a441756ec7c30f46d45091f3f90e
diff --git a/vendor/github.com/rs/zerolog/ctx.go b/vendor/github.com/rs/zerolog/ctx.go
new file mode 100644
index 0000000..2b7a682
--- /dev/null
+++ b/vendor/github.com/rs/zerolog/ctx.go
@@ -0,0 +1,47 @@
+package zerolog
+
+import (
+ "context"
+)
+
+var disabledLogger *Logger
+
+func init() {
+ l := Nop()
+ disabledLogger = &l
+}
+
+type ctxKey struct{}
+
+// WithContext returns a copy of ctx with l associated. If an instance of Logger
+// is already in the context, the context is not updated.
+//
+// For instance, to add a field to an existing logger in the context, use this
+// notation:
+//
+// ctx := r.Context()
+// l := zerolog.Ctx(ctx)
+// l.UpdateContext(func(c Context) Context {
+// return c.Str("bar", "baz")
+// })
+func (l *Logger) WithContext(ctx context.Context) context.Context {
+ if lp, ok := ctx.Value(ctxKey{}).(*Logger); ok {
+ if lp == l {
+ // Do not store same logger.
+ return ctx
+ }
+ } else if l.level == Disabled {
+ // Do not store disabled logger.
+ return ctx
+ }
+ return context.WithValue(ctx, ctxKey{}, l)
+}
+
+// Ctx returns the Logger associated with the ctx. If no logger
+// is associated, a disabled logger is returned.
+func Ctx(ctx context.Context) *Logger {
+ if l, ok := ctx.Value(ctxKey{}).(*Logger); ok {
+ return l
+ }
+ return disabledLogger
+}