Skip to content

Commit

Permalink
Add host and HTTP method to request log
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setters <[email protected]>
  • Loading branch information
asetty committed Dec 23, 2020
1 parent 3d7904d commit 6f33e5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ func realpath(path string) (string, error) {

func loggerForRequest(r *http.Request) *log.Entry {
return log.WithContext(r.Context()).WithFields(log.Fields{
"ip": getUserIP(r),
"request": r.URL.String(),
"ip": getUserIP(r),
"host": r.Host,
"path": r.URL.String(),
"method": r.Method,
})
}

Expand Down

0 comments on commit 6f33e5a

Please sign in to comment.