moved logger into middleware

This commit is contained in:
bronku 2025-03-21 23:39:12 +01:00
parent e75468ce55
commit a70d5a8548
2 changed files with 6 additions and 5 deletions

17
middleware/logger.go Normal file
View file

@ -0,0 +1,17 @@
package middleware
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))
}
}