kyra/log.go

23 lines
321 B
Go
Raw Normal View History

2024-06-09 16:26:31 +03:00
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)
}