2018-04-28 05:38:46 +02: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 06:51:50 +02:00
|
|
|
package middleware // import "miniflux.app/middleware"
|
2018-04-28 05:38:46 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2018-08-25 06:51:50 +02:00
|
|
|
"miniflux.app/http/request"
|
|
|
|
"miniflux.app/logger"
|
2018-04-28 05:38:46 +02: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 16:22:18 +02:00
|
|
|
logger.Debug("[HTTP] %s %s %s", request.RealIP(r), r.Method, r.RequestURI)
|
2018-04-28 05:38:46 +02:00
|
|
|
next.ServeHTTP(w, r)
|
|
|
|
})
|
|
|
|
}
|