Skip to content

Commit

Permalink
Pass Context into requestlog Entry
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyreiss committed Mar 31, 2021
1 parent db7a6e7 commit 70109f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/requestlog/requestlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package requestlog // import "gocloud.dev/server/requestlog"

import (
"bufio"
"context"
"errors"
"io"
"io/ioutil"
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 70109f8

Please sign in to comment.