diff --git a/pkg/ext/log.go b/pkg/ext/log.go
index a9d26a9afd92ce2309d6f27653577a97a9b76c1e..2439f19dc40646808ca040750df03646d7d9253c 100644
--- a/pkg/ext/log.go
+++ b/pkg/ext/log.go
@@ -8,6 +8,7 @@ )
type statusWraper struct {
statusCode int
+ size int
innerWriter http.ResponseWriter
}
@@ -16,6 +17,7 @@ return s.innerWriter.Header()
}
func (s *statusWraper) Write(b []byte) (int, error) {
+ s.size += len(b)
return s.innerWriter.Write(b)
}
@@ -42,12 +44,15 @@ return func(w http.ResponseWriter, r *http.Request) {
t := time.Now()
s := wrap(w)
next(s, r)
+ encoding := s.Header().Get("Content-Encoding")
slog.Info(
- "Http request",
+ "HTTP request",
"method", r.Method,
"code", s.StatusCode(),
"path", r.URL,
+ "encoding", encoding,
"elapsed", time.Since(t),
+ "body-size", s.size,
)
}
}