cake-order-tracker/middleware.go
2025-02-07 09:27:20 +01:00

17 lines
349 B
Go

package main
import (
"fmt"
"net/http"
"time"
)
func logger(in http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
//log := fmt.Sprint(r.Method, " ", r.URL.String())
fmt.Println(r.Method, r.URL.String())
in(w, r)
fmt.Println(r.Method, "finished in", time.Since(start))
}
}