aboutsummaryrefslogtreecommitdiffhomepage
path: root/middleware/logging.go
blob: fdf1ce3fbc40471b5be4912bc2a76638cb6795e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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.

package middleware // import "miniflux.app/middleware"

import (
	"net/http"

	"miniflux.app/http/request"
	"miniflux.app/logger"
)

// Logging logs the HTTP request.
func (m *Middleware) Logging(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		logger.Debug("[HTTP] %s %s %s", request.ClientIP(r), r.Method, r.RequestURI)
		next.ServeHTTP(w, r)
	})
}