aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-07-05 12:07:29 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-07-05 12:07:29 +0200
commit8dff852753a1c4a708fd87e3cbb0f4844803aa95 (patch)
treec589e6b4722c7bb5ff5c648e350232419c58b456 /pkg/ext
parent1b1460c8d4fa358433c51fd5293fd1c79f32aeff (diff)
downloadcerrado-0.0.10.tar.gz
cerrado-0.0.10.tar.bz2
cerrado-0.0.10.zip
feat: Add user-agent to logsv0.0.10
Diffstat (limited to 'pkg/ext')
-rw-r--r--pkg/ext/log.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/ext/log.go b/pkg/ext/log.go
index 2439f19..8e68134 100644
--- a/pkg/ext/log.go
+++ b/pkg/ext/log.go
@@ -45,12 +45,14 @@ func Log(next http.HandlerFunc) http.HandlerFunc {
s := wrap(w)
next(s, r)
encoding := s.Header().Get("Content-Encoding")
+ userAgent := r.Header.Get("User-Agent")
slog.Info(
"HTTP request",
"method", r.Method,
"code", s.StatusCode(),
"path", r.URL,
"encoding", encoding,
+ "user-agent", userAgent,
"elapsed", time.Since(t),
"body-size", s.size,
)