mirror of
https://github.com/Luzifer/go_helpers.git
synced 2024-12-25 13:31:21 +00:00
Also log query parameters
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c3bea85c97
commit
f8065b8366
1 changed files with 6 additions and 1 deletions
|
@ -27,10 +27,15 @@ func (l HTTPLogHandler) ServeHTTP(res http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
l.Handler.ServeHTTP(ares, r)
|
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",
|
log.Printf("%s - \"%s %s\" %d %d \"%s\" \"%s\" %s",
|
||||||
l.findIP(r),
|
l.findIP(r),
|
||||||
r.Method,
|
r.Method,
|
||||||
r.URL.Path,
|
path,
|
||||||
ares.StatusCode,
|
ares.StatusCode,
|
||||||
ares.Size,
|
ares.Size,
|
||||||
r.Header.Get("Referer"),
|
r.Header.Get("Referer"),
|
||||||
|
|
Loading…
Reference in a new issue