|
|
@ -121,11 +121,6 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ |
|
|
|
t.NodeName = host |
|
|
|
t.NodeName = host |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rw := logger.NewResponseWriter(w) |
|
|
|
|
|
|
|
rw.LogErrBody = true |
|
|
|
|
|
|
|
rw.LogAllBody = logBody |
|
|
|
|
|
|
|
f(rw, r) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rq := trace.RequestInfo{ |
|
|
|
rq := trace.RequestInfo{ |
|
|
|
Time: time.Now().UTC(), |
|
|
|
Time: time.Now().UTC(), |
|
|
|
Proto: r.Proto, |
|
|
|
Proto: r.Proto, |
|
|
@ -134,8 +129,15 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ |
|
|
|
RawQuery: r.URL.RawQuery, |
|
|
|
RawQuery: r.URL.RawQuery, |
|
|
|
Client: handlers.GetSourceIP(r), |
|
|
|
Client: handlers.GetSourceIP(r), |
|
|
|
Headers: reqHeaders, |
|
|
|
Headers: reqHeaders, |
|
|
|
Body: reqBodyRecorder.Data(), |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rw := logger.NewResponseWriter(w) |
|
|
|
|
|
|
|
rw.LogErrBody = true |
|
|
|
|
|
|
|
rw.LogAllBody = logBody |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Execute call.
|
|
|
|
|
|
|
|
f(rw, r) |
|
|
|
|
|
|
|
|
|
|
|
rs := trace.ResponseInfo{ |
|
|
|
rs := trace.ResponseInfo{ |
|
|
|
Time: time.Now().UTC(), |
|
|
|
Time: time.Now().UTC(), |
|
|
|
Headers: rw.Header().Clone(), |
|
|
|
Headers: rw.Header().Clone(), |
|
|
@ -143,6 +145,9 @@ func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Requ |
|
|
|
Body: rw.Body(), |
|
|
|
Body: rw.Body(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Transfer request body
|
|
|
|
|
|
|
|
rq.Body = reqBodyRecorder.Data() |
|
|
|
|
|
|
|
|
|
|
|
if rs.StatusCode == 0 { |
|
|
|
if rs.StatusCode == 0 { |
|
|
|
rs.StatusCode = http.StatusOK |
|
|
|
rs.StatusCode = http.StatusOK |
|
|
|
} |
|
|
|
} |
|
|
|