1
0
Fork 0
mirror of https://github.com/Luzifer/go_helpers.git synced 2024-12-25 05:21:20 +00:00

Also log query parameters

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-11-19 00:27:55 +01:00
parent c3bea85c97
commit f8065b8366
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -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"),