Add http request scheme to logger

This commit is contained in:
Felipe 2020-02-17 06:46:04 -03:00 committed by GitHub
parent 7c430e5c9d
commit 1c764052f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 3 deletions

View file

@ -193,6 +193,11 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http
core[RequestPath] = urlCopyString
core[RequestProtocol] = req.Proto
core[RequestScheme] = "http"
if req.TLS != nil {
core[RequestScheme] = "https"
}
core[ClientAddr] = req.RemoteAddr
core[ClientHost], core[ClientPort] = silentSplitHostPort(req.RemoteAddr)