2018-04-27 23:38:46 -04:00
|
|
|
// Copyright 2018 Frédéric Guillot. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Apache 2.0
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2018-08-25 00:51:50 -04:00
|
|
|
package middleware // import "miniflux.app/middleware"
|
2018-04-27 23:38:46 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2018-08-25 00:51:50 -04:00
|
|
|
"miniflux.app/http/request"
|
|
|
|
"miniflux.app/logger"
|
2018-04-27 23:38:46 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Logging logs the HTTP request.
|
|
|
|
func (m *Middleware) Logging(next http.Handler) http.Handler {
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2018-06-01 10:22:18 -04:00
|
|
|
logger.Debug("[HTTP] %s %s %s", request.RealIP(r), r.Method, r.RequestURI)
|
2018-04-27 23:38:46 -04:00
|
|
|
next.ServeHTTP(w, r)
|
|
|
|
})
|
|
|
|
}
|