Skip to content

Commit 7aa4f8f

Browse files
committed
log: WithLogger: remove redundant intermediate var
Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 4a36022) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent bfdce4c commit 7aa4f8f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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)