Skip to content

Commit 4390c4d

Browse files
committed
added comment for chi ctx extraction
1 parent 2212f08 commit 4390c4d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

coderd/httpmw/loggermw/logger.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ func (c *SlogRequestLogger) WriteLog(ctx context.Context, status int) {
138138
slog.F("latency_ms", float64(end.Sub(c.start)/time.Millisecond)),
139139
)
140140

141+
// If the request is routed, add the route parameters to the log.
141142
if chiCtx := chi.RouteContext(ctx); chiCtx != nil {
142143
urlParams := chiCtx.URLParams
143144
routeParamsFields := make([]slog.Field, 0, len(urlParams.Keys))

0 commit comments

Comments
 (0)