mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
25 lines
417 B
Go
25 lines
417 B
Go
package main
|
|
|
|
//@ NOTE Shyft logs responses in terminal
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
//Logger logs responses to terminal
|
|
func Logger(inner http.Handler, name string) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
start := time.Now()
|
|
|
|
inner.ServeHTTP(w, r)
|
|
|
|
log.Printf(
|
|
"%s\t%s\t%s\t%s",
|
|
r.Method,
|
|
r.RequestURI,
|
|
name,
|
|
time.Since(start),
|
|
)
|
|
})
|
|
}
|