From f8065b83661ad60798f64a13eb784d89f2b57667 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 19 Nov 2018 00:27:55 +0100 Subject: [PATCH] Also log query parameters Signed-off-by: Knut Ahlers --- http/logHandler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http/logHandler.go b/http/logHandler.go index 95b7bc6..4554e74 100644 --- a/http/logHandler.go +++ b/http/logHandler.go @@ -27,10 +27,15 @@ func (l HTTPLogHandler) ServeHTTP(res http.ResponseWriter, r *http.Request) { l.Handler.ServeHTTP(ares, r) + path := r.URL.Path + if q := r.URL.Query().Encode(); len(q) > 0 { + path = path + "?" + q + } + log.Printf("%s - \"%s %s\" %d %d \"%s\" \"%s\" %s", l.findIP(r), r.Method, - r.URL.Path, + path, ares.StatusCode, ares.Size, r.Header.Get("Referer"),