Skip to content

feat: extend request logs with auth & DB info #17304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 15, 2025
Prev Previous commit
Next Next commit
added comment for chi ctx extraction
  • Loading branch information
ibetitsmike committed Apr 14, 2025
commit 8ef56461165eb68835896cde7b0aa13d783ea26f
1 change: 1 addition & 0 deletions coderd/httpmw/loggermw/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func (c *SlogRequestLogger) WriteLog(ctx context.Context, status int) {
slog.F("latency_ms", float64(end.Sub(c.start)/time.Millisecond)),
)

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