From 70109f835150ada441c1c05f4a3d6eb519196954 Mon Sep 17 00:00:00 2001 From: Mickey Reiss Date: Thu, 11 Mar 2021 22:35:57 -0800 Subject: [PATCH] Pass Context into requestlog Entry --- server/requestlog/requestlog.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/requestlog/requestlog.go b/server/requestlog/requestlog.go index 4f97ec6b49..e89c109390 100644 --- a/server/requestlog/requestlog.go +++ b/server/requestlog/requestlog.go @@ -18,6 +18,7 @@ package requestlog // import "gocloud.dev/server/requestlog" import ( "bufio" + "context" "errors" "io" "io/ioutil" @@ -58,6 +59,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { start := time.Now() sc := trace.FromContext(r.Context()).SpanContext() ent := &Entry{ + Context: r.Context(), ReceivedTime: start, RequestMethod: r.Method, RequestURL: r.URL.String(), @@ -97,6 +99,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Entry records information about a completed HTTP request. type Entry struct { + Context context.Context + ReceivedTime time.Time RequestMethod string RequestURL string