caddyhttp: Log 4xx as INFO; 5xx as ERROR (close #6106)

This commit is contained in:
Matthew Holt 2024-05-10 15:52:50 -06:00
parent 399186abfc
commit 4af38e5ac8
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -784,7 +784,7 @@ func (s *Server) logRequest(
// wrapping may return multiple loggers, so we log to all of them // wrapping may return multiple loggers, so we log to all of them
for _, logger := range loggers { for _, logger := range loggers {
logAtLevel := logger.Info logAtLevel := logger.Info
if wrec.Status() >= 400 { if wrec.Status() >= 500 {
logAtLevel = logger.Error logAtLevel = logger.Error
} }
message := "handled request" message := "handled request"