File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -9,19 +9,19 @@ import (
9
9
"go.uber.org/zap"
10
10
)
11
11
12
- var (
12
+ type (
13
13
ctxLogger struct {}
14
14
ctxClient struct {}
15
15
)
16
16
17
17
// WithLogger returns the context with zap.Logger value.
18
18
func WithLogger (ctx context.Context , logger * zap.Logger ) context.Context {
19
- return context .WithValue (ctx , ctxLogger , logger )
19
+ return context .WithValue (ctx , ctxLogger {} , logger )
20
20
}
21
21
22
22
// LoggerFromContext extracts zap.Logger from context.
23
23
func LoggerFromContext (ctx context.Context ) * zap.Logger {
24
- logger , ok := ctx .Value (ctxLogger ).(* zap.Logger )
24
+ logger , ok := ctx .Value (ctxLogger {} ).(* zap.Logger )
25
25
if ! ok {
26
26
return zap .NewNop ()
27
27
}
@@ -31,5 +31,5 @@ func LoggerFromContext(ctx context.Context) *zap.Logger {
31
31
32
32
// WithClient returns the context with Client value.
33
33
func WithClient (ctx context.Context , client Client ) context.Context {
34
- return context .WithValue (ctx , ctxClient , client )
34
+ return context .WithValue (ctx , ctxClient {} , client )
35
35
}
You can’t perform that action at this time.
0 commit comments