samber / slog-chi

🚨 Chi middleware for slog logger
https://pkg.go.dev/github.com/samber/slog-chi
MIT License
48 stars 6 forks source link

Duplicate log messages on 4xx and 5xx statuses #3

Closed tazimmerman closed 1 year ago

tazimmerman commented 1 year ago

I could be missing something, but it seems that responses with a 4xx or 5xx status are logged twice -- once in the check for the range of status codes, and once after that block regardless of status.

https://github.com/samber/slog-chi/blob/1124a4272621adffe954db40880cdd712f54f5fe/middleware.go#L194

Is that intentional?

samber commented 1 year ago

Definitely not :-(

I just made a fix. Thanks for the feedback.

-> v1.3.0