From 50dae8f4f679f56871ec1ddcb6fcffdf6e7e62a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Tue, 16 Apr 2013 19:03:29 +0200 Subject: [PATCH] Add reply logging --- src/cmd/tusd/http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmd/tusd/http.go b/src/cmd/tusd/http.go index 6af5cde..7550a6b 100644 --- a/src/cmd/tusd/http.go +++ b/src/cmd/tusd/http.go @@ -10,6 +10,7 @@ import ( "path" "regexp" "strconv" + "time" ) // fileRoute matches /files/. Go seems to use \r to terminate header @@ -66,6 +67,7 @@ func serveHttp() error { } func route(w http.ResponseWriter, r *http.Request) { + start := time.Now() log.Printf("request: %s %s", r.Method, r.URL.RequestURI()) w.Header().Set("Server", "tusd") @@ -99,6 +101,9 @@ func route(w http.ResponseWriter, r *http.Request) { } else { reply(w, http.StatusNotFound, "No matching route") } + + duration := time.Since(start) + log.Printf("finished: %s %s (took %s)", r.Method, r.URL.RequestURI(), duration) } func reply(w http.ResponseWriter, code int, message string) {