Skip to content

Commit

Permalink
log: WithLogger: remove redundant intermediate var
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4a36022)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Sep 8, 2023
1 parent c193255 commit 6e8f455
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions log/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func SetFormat(format string) error {
// WithLogger returns a new context with the provided logger. Use in
// combination with logger.WithField(s) for great effect.
func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context {
e := logger.WithContext(ctx)
return context.WithValue(ctx, loggerKey{}, e)
return context.WithValue(ctx, loggerKey{}, logger.WithContext(ctx))
}

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

0 comments on commit 6e8f455

Please sign in to comment.