diff --git a/rest/handler/loghandler.go b/rest/handler/loghandler.go index f28e0d262..5801f4305 100644 --- a/rest/handler/loghandler.go +++ b/rest/handler/loghandler.go @@ -127,6 +127,14 @@ func dumpRequest(r *http.Request) string { return string(reqContent) } +func getSlowThreshold(r *http.Request) time.Duration { + if r.Header.Get(headerAccept) == valueSSE { + return sseSlowThreshold.Load() + } else { + return slowThreshold.Load() + } +} + func isOkResponse(code int) bool { // not server error return code < http.StatusInternalServerError @@ -234,12 +242,3 @@ func wrapStatusCode(code int) string { return logx.WithColorPadding(strconv.Itoa(code), colour) } - -func getSlowThreshold(r *http.Request) time.Duration { - threshold := slowThreshold.Load() - if r.Header.Get(headerAccept) == valueSSE { - threshold = sseSlowThreshold.Load() - } - - return threshold -}