diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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, + ) }, ) } |
