Skip to content

Commit

Permalink
g
Browse files Browse the repository at this point in the history
  • Loading branch information
komuw committed Aug 17, 2024
1 parent fbb0399 commit 802c30b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions config/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ func ExampleNew() {
config.SingleIpStrategy("CF-Connecting-IP"),
// function to log in middlewares.
func(_ http.ResponseWriter, r http.Request, statusCode int, fields []any) {
reqL := log.WithID(r.Context(), l)
reqL.Info("request-and-response", fields...)
if statusCode >= http.StatusInternalServerError {
// Only log 500's
reqL := log.WithID(r.Context(), l)
fields = append(fields, "statusCode", statusCode)
reqL.Info("request-and-response", fields...)
}
},
// If a particular IP address sends more than 13 requests per second, throttle requests from that IP.
13.0,
Expand Down

0 comments on commit 802c30b

Please sign in to comment.