Skip to content

Commit

Permalink
Rename param
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Jul 24, 2022
1 parent 92c977e commit 773ad3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ type ctxKeyTraceID struct{}

// TraceLoggingMiddleware sets up a trace ID in the request context and
// logs HTTP requests.
func TraceLoggingMiddleware(next http.Handler, logger log.Logger, newTrace func(*http.Request) string) http.HandlerFunc {
func TraceLoggingMiddleware(next http.Handler, logger log.Logger, traceID func(*http.Request) string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
if newTrace != nil {
ctx = context.WithValue(r.Context(), ctxKeyTraceID{}, newTrace(r))
if traceID != nil {
ctx = context.WithValue(r.Context(), ctxKeyTraceID{}, traceID(r))
ctx = ctxlog.AddFunc(ctx, ctxlog.SimpleStringFunc("trace_id", ctxKeyTraceID{}))
}

Expand Down

0 comments on commit 773ad3b

Please sign in to comment.