[ARVADOS] updated: 2ddfdc072e53b581d1aae418136f1a5f8f495abf

git at public.curoverse.com git at public.curoverse.com
Fri May 8 01:17:37 EDT 2015


Summary of changes:
 services/keepstore/logging_router.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

       via  2ddfdc072e53b581d1aae418136f1a5f8f495abf (commit)
      from  10c7a157c03405a6986fdd8924d7f45a71803875 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 2ddfdc072e53b581d1aae418136f1a5f8f495abf
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri May 8 01:17:40 2015 -0400

    5748: Log clock time for each request.
    
    For successful responses, log the standard HTTP status text for the
    response code (instead of logging "OK" for any status<400).

diff --git a/services/keepstore/logging_router.go b/services/keepstore/logging_router.go
index e30df87..b622d1d 100644
--- a/services/keepstore/logging_router.go
+++ b/services/keepstore/logging_router.go
@@ -8,6 +8,7 @@ import (
 	"log"
 	"net/http"
 	"strings"
+	"time"
 )
 
 type LoggingResponseWriter struct {
@@ -40,12 +41,13 @@ func MakeLoggingRESTRouter() *LoggingRESTRouter {
 }
 
 func (loggingRouter *LoggingRESTRouter) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
-	loggingWriter := LoggingResponseWriter{200, 0, resp, ""}
+	t0 := time.Now()
+	loggingWriter := LoggingResponseWriter{http.StatusOK, 0, resp, ""}
 	loggingRouter.router.ServeHTTP(&loggingWriter, req)
-	statusText := "OK"
+	statusText := http.StatusText(loggingWriter.Status)
 	if loggingWriter.Status >= 400 {
 		statusText = strings.Replace(loggingWriter.ResponseBody, "\n", "", -1)
 	}
-	log.Printf("[%s] %s %s %d %d \"%s\"", req.RemoteAddr, req.Method, req.URL.Path[1:], loggingWriter.Status, loggingWriter.Length, statusText)
+	log.Printf("[%s] %s %s %.6fs %d %d \"%s\"", req.RemoteAddr, req.Method, req.URL.Path[1:], time.Since(t0).Seconds(), loggingWriter.Status, loggingWriter.Length, statusText)
 
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list