Update for the PR feedback

pull/6/head
Philibert Dugas 2016-09-22 13:30:04 -04:00
parent 9c2705a5a2
commit b557acf987
No known key found for this signature in database
GPG Key ID: 3907E2E57F97F72C
1 changed files with 4 additions and 2 deletions

View File

@ -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)
})