init
This commit is contained in:
commit
fa6a4c650f
93 files changed
+6555
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Logging(
|
||||
next http.Handler,
|
||||
) http.Handler {
|
||||
|
||||
return http.HandlerFunc(
|
||||
func(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
) {
|
||||
|
||||
start := time.Now()
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
|
||||
log.Printf(
|
||||
"%s %s %s",
|
||||
r.Method,
|
||||
r.URL.Path,
|
||||
time.Since(start),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user