Feat: better logs; login page
This commit is contained in:
@ -32,17 +32,13 @@ func (w *responseWriterWrapper) WriteHeader(status int) {
|
||||
func LogRequests(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
start := time.Now()
|
||||
log.Info("request started", "method", r.Method, "path", r.URL.Path)
|
||||
|
||||
// Wrap response writer to capture status code
|
||||
ww := &responseWriterWrapper{ResponseWriter: w}
|
||||
|
||||
next.ServeHTTP(ww, r)
|
||||
|
||||
duration := time.Since(start)
|
||||
log.Debug("request completed",
|
||||
"method", r.Method,
|
||||
"path", r.URL.Path,
|
||||
log.Debug("request completed",
|
||||
"method", r.Method,
|
||||
"path", r.URL.Path,
|
||||
"status", ww.status,
|
||||
"duration", duration.String(),
|
||||
)
|
||||
|
Reference in New Issue
Block a user