mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Use Gorilla middleware (refactoring)
This commit is contained in:
parent
322b265d7a
commit
6b360d08c1
25 changed files with 1254 additions and 331 deletions
20
middleware/logging.go
Normal file
20
middleware/logging.go
Normal file
|
@ -0,0 +1,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 (
|
||||
"net/http"
|
||||
|
||||
"github.com/miniflux/miniflux/logger"
|
||||
"github.com/tomasen/realip"
|
||||
)
|
||||
|
||||
// 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", realip.RealIP(r), r.Method, r.RequestURI)
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue