log: WithLogger: remove redundant intermediate var
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
40ee5fb11b
commit
4a36022e20
@ -103,8 +103,7 @@ func SetFormat(format string) error {
|
|||||||
// WithLogger returns a new context with the provided logger. Use in
|
// WithLogger returns a new context with the provided logger. Use in
|
||||||
// combination with logger.WithField(s) for great effect.
|
// combination with logger.WithField(s) for great effect.
|
||||||
func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context {
|
func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context {
|
||||||
e := logger.WithContext(ctx)
|
return context.WithValue(ctx, loggerKey{}, logger.WithContext(ctx))
|
||||||
return context.WithValue(ctx, loggerKey{}, e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLogger retrieves the current logger from the context. If no logger is
|
// GetLogger retrieves the current logger from the context. If no logger is
|
||||||
|
Loading…
Reference in New Issue
Block a user