1
0
mirror of https://github.com/containous/traefik.git synced 2025-01-14 19:24:23 +03:00
traefik/middlewares/saveBackend.go
Emile Vauge 82651985c4
Revert "First stage of access logging middleware. Initially without any output appenders."
This reverts commit 73a1b172ed8f31300349843af99051ea92b78eb9.
2017-05-03 17:30:31 +02:00

21 lines
422 B
Go

package middlewares
import (
"net/http"
)
// SaveBackend sends the backend name to the logger.
type SaveBackend struct {
next http.Handler
}
// NewSaveBackend creates a SaveBackend
func NewSaveBackend(next http.Handler) *SaveBackend {
return &SaveBackend{next}
}
func (sb *SaveBackend) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
saveBackendNameForLogger(r, (*r.URL).String())
sb.next.ServeHTTP(rw, r)
}