feat: Access Logging on the user server

Closes: #98

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2020-12-16 17:51:22 +01:00
parent 41be4f9344
commit 4d05223224
7 changed files with 93 additions and 4 deletions
@@ -45,6 +45,7 @@ func handlerBuilder(route model.Route) http.Handler {
Route: route,
Request: r,
Writer: w,
Status: 200,
}
data.Handlers.Add(h)
@@ -78,6 +79,20 @@ func handlerBuilder(route model.Route) http.Handler {
logger.L.Println(err)
}
if r != nil {
logger.LogAccess(
r.RemoteAddr,
h.ID,
"-",
r.Method,
r.RequestURI,
r.Proto,
h.Status,
h.SentBytes,
r.Header.Get("Referer"),
r.Header.Get("User-Agent"),
)
}
})
}