mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Minor naming and control flow changes to satisfy golint
This commit is contained in:
@@ -6,14 +6,16 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type contextKey string
|
||||
|
||||
// WithLogger stores the logger.
|
||||
func WithLogger(ctx context.Context, l logrus.FieldLogger) context.Context {
|
||||
return context.WithValue(ctx, "logger", l)
|
||||
return context.WithValue(ctx, contextKey("logger"), l)
|
||||
}
|
||||
|
||||
// Logger returns the structured logger.
|
||||
func Logger(ctx context.Context) logrus.FieldLogger {
|
||||
l, ok := ctx.Value("logger").(logrus.FieldLogger)
|
||||
l, ok := ctx.Value(contextKey("logger")).(logrus.FieldLogger)
|
||||
if !ok {
|
||||
return logrus.StandardLogger()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user