I have a use case for httplog to act as an audit capability that logs all requests and responses to/from the system. With the current implementation, the response body is only "auditable" if the server processes the request with an error.
My suggestion is to include a new configurable option that would be used for the condition rather than status >= 400. The option can default to the existing logic but allow consumers to define if they want response bodies to be logged in different situations.
Currently, the response body will only be logged if the returned status code is >= 400.
https://github.com/go-chi/httplog/blob/master/httplog.go#L90C4-L96C7. https://github.com/go-chi/httplog/blob/master/httplog.go#L146C3-L149C4.
I have a use case for
httplog
to act as an audit capability that logs all requests and responses to/from the system. With the current implementation, the response body is only "auditable" if the server processes the request with an error.My suggestion is to include a new configurable option that would be used for the condition rather than
status >= 400
. The option can default to the existing logic but allow consumers to define if they want response bodies to be logged in different situations.