Update for the PR feedback

parent 9c2705a5
......@@ -141,9 +141,10 @@ func RecoverPanics(handler http.Handler, resolver *RequestInfoResolver) http.Han
glog.Errorf("APIServer panic'd on %v %v: %v\n%s\n", req.Method, req.RequestURI, err, debug.Stack())
})
logger := httplog.NewLogged(req, &w)
requestInfo, err := resolver.GetRequestInfo(req)
if err != nil || requestInfo.Verb != "proxy" {
defer httplog.NewLogged(req, &w).StacktraceWhen(
logger.StacktraceWhen(
httplog.StatusIsNot(
http.StatusOK,
http.StatusCreated,
......@@ -159,8 +160,9 @@ func RecoverPanics(handler http.Handler, resolver *RequestInfoResolver) http.Han
errors.StatusUnprocessableEntity,
http.StatusSwitchingProtocols,
),
).Log()
)
}
defer logger.Log()
// Dispatch to the internal handler
handler.ServeHTTP(w, req)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment