kyra/log.go
2024-06-09 18:26:31 +05:00

22 lines
321 B
Go

package tht
import "log"
import "net/http"
type LoggerMiddle struct {
Logger *log.Logger
After http.Handler
}
func (l *LoggerMiddle) ServeHTTP(
w http.ResponseWriter, r *http.Request,
) {
if l.Logger != nil {
l.Logger.Printf(
"%s %s %q\n",
r.RemoteAddr, r.Method, r.URL,
)
}
l.After.ServeHTTP(w, r)
}