videopage/logger.go

19 lines
311 B
Go

package main
import (
"log"
"net/http"
)
type Logger struct {
h http.Handler
}
func NewLogger(h http.Handler) (l *Logger) {
return &Logger{h: h}
}
func (l *Logger) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Printf("%s %s %s%s", r.RemoteAddr, r.Method, r.Host, r.URL)
l.h.ServeHTTP(w, r)
}