Skip to content

Commit 4a36022

Browse files
committed
log: WithLogger: remove redundant intermediate var
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 40ee5fb commit 4a36022

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

log/context.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ func SetFormat(format string) error {
103103
// WithLogger returns a new context with the provided logger. Use in
104104
// combination with logger.WithField(s) for great effect.
105105
func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context {
106-
e := logger.WithContext(ctx)
107-
return context.WithValue(ctx, loggerKey{}, e)
106+
return context.WithValue(ctx, loggerKey{}, logger.WithContext(ctx))
108107
}
109108

110109
// GetLogger retrieves the current logger from the context. If no logger is

0 commit comments

Comments
 (0)