refactor: adjust http request slow log format (#2440)

master
chen quan 2 years ago committed by GitHub
parent 1a6d7b3ef6
commit 111e626a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -170,9 +170,9 @@ func logBrief(r *http.Request, code int, timer *utils.ElapsedTimer, logs *intern
buf.WriteString(fmt.Sprintf("[HTTP] %s - %s %s - %s - %s",
wrapStatusCode(code), wrapMethod(r.Method), r.RequestURI, httpx.GetRemoteAddr(r), r.UserAgent()))
if duration > slowThreshold.Load() {
logger.Slowf("[HTTP] %s - %s - %s %s - %s - slowcall(%s)",
logger.Slowf("[HTTP] %s - %s %s - %s - %s - slowcall(%s)",
wrapStatusCode(code), wrapMethod(r.Method), r.RequestURI, httpx.GetRemoteAddr(r), r.UserAgent(),
fmt.Sprintf("slowcall(%s)", timex.ReprOfDuration(duration)))
timex.ReprOfDuration(duration))
}
ok := isOkResponse(code)

Loading…
Cancel
Save