summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.go b/main.go
index f12cf33..a9b47b8 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,7 @@ import (
"fmt"
"log"
"net/http"
+ "time"
)
func main() {
@@ -24,6 +25,7 @@ func main() {
mux.HandleFunc(
route,
func (wr http.ResponseWriter, r *http.Request) {
+ start := time.Now()
resCh := w.Request(route, r)
res := <- resCh
for k, h := range res.Headers {
@@ -31,6 +33,13 @@ func main() {
}
wr.WriteHeader(int(res.Code))
fmt.Fprint(wr, string(res.Body))
+ log.Printf(
+ "%s %s (%s) -> %d\n",
+ r.Method,
+ r.URL.Path,
+ time.Now().Sub(start),
+ res.Code,
+ )
},
)
}