passed/middlewares/logger.go

14 lines
254 B
Go
Raw Permalink Normal View History

2024-10-30 09:24:41 +00:00
package middlewares
2024-10-29 23:08:11 +00:00
import (
"log"
"net/http"
)
func Logger(handler http.Handler) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) {
2024-10-30 09:44:37 +00:00
log.Printf("%-30s %s", req.RemoteAddr, req.URL.Path)
2024-10-29 23:08:11 +00:00
handler.ServeHTTP(res, req)
}
}