[Upload]网络请求日志分级
This commit is contained in:
15
.idea/git_toolbox_prj.xml
generated
Normal file
15
.idea/git_toolbox_prj.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationConfigOverride">
|
||||
<CommitMessageValidationOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</CommitMessageValidationOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -42,15 +42,16 @@ class HttpLoggingInterceptor : Interceptor {
|
||||
}
|
||||
|
||||
val logMsg = StringBuilder()
|
||||
.append("------> http request start").append("\r\n")
|
||||
.append(protocol).append(", ")
|
||||
.append(request.method()).append("\r\n")
|
||||
.append("Request Headers: {").append(request.headers().toString().replace("\n",", ")).append("}\r\n")
|
||||
.append("Url: ").append(request.url()).append("\r\n")
|
||||
.append("Content-Type: ").append(requestBody?.contentType()).append("\r\n")
|
||||
.append("Content-Length: ").append(requestBody?.contentLength()).append("\r\n")
|
||||
.append("Content-body: ").append(body).append("\r\n")
|
||||
.append("------> http request end").append("\r\n").append("\r\n")
|
||||
.append("------> http request start").append("\r\n")
|
||||
.append(protocol).append(", ")
|
||||
.append(request.method()).append("\r\n")
|
||||
.append("Request Headers: {").append(request.headers().toString().replace("\n", ", "))
|
||||
.append("}\r\n")
|
||||
.append("Url: ").append(request.url()).append("\r\n")
|
||||
.append("Content-Type: ").append(requestBody?.contentType()).append("\r\n")
|
||||
.append("Content-Length: ").append(requestBody?.contentLength()).append("\r\n")
|
||||
.append("Content-body: ").append(body).append("\r\n")
|
||||
.append("------> http request end").append("\r\n").append("\r\n")
|
||||
|
||||
|
||||
val startTime = System.nanoTime()
|
||||
@@ -72,16 +73,21 @@ class HttpLoggingInterceptor : Interceptor {
|
||||
}
|
||||
|
||||
logMsg.append("------> http response start").append("\r\n")
|
||||
.append(response.code()).append(" ")
|
||||
.append(response.message()).append(" ")
|
||||
.append(response.protocol()).append(" ").append("\r\n")
|
||||
.append("Response Content: ").append(responseContent).append("\r\n")
|
||||
.append("Content-Type: ").append(contentType).append("\r\n")
|
||||
.append("Content-Length: ").append(bodySize).append("\r\n")
|
||||
.append("Time: (").append(endTime).append("ms)").append("\r\n")
|
||||
.append("------> http response end")
|
||||
Logger.d(TAG, logMsg.toString())
|
||||
return if (consumedResponse) response.newBuilder().body(ResponseBody.create(contentType, responseContent)).build() else response
|
||||
.append(response.code()).append(" ")
|
||||
.append(response.message()).append(" ")
|
||||
.append(response.protocol()).append(" ").append("\r\n")
|
||||
.append("Response Content: ").append(responseContent).append("\r\n")
|
||||
.append("Content-Type: ").append(contentType).append("\r\n")
|
||||
.append("Content-Length: ").append(bodySize).append("\r\n")
|
||||
.append("Time: (").append(endTime).append("ms)").append("\r\n")
|
||||
.append("------> http response end")
|
||||
if (response.code() != 200) {
|
||||
Logger.e(TAG, logMsg.toString())
|
||||
} else {
|
||||
Logger.d(TAG, logMsg.toString())
|
||||
}
|
||||
return if (consumedResponse) response.newBuilder()
|
||||
.body(ResponseBody.create(contentType, responseContent)).build() else response
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,22 +36,22 @@ PASSWORD=xintai2018
|
||||
RELEASE=true
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.3.3
|
||||
MOGO_UTILS_VERSION=1.3.4
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.3.3
|
||||
MOGO_NETWORK_VERSION=1.3.4
|
||||
# 网络DNS
|
||||
MOGO_HTTPDNS_VERSION=1.3.3
|
||||
MOGO_HTTPDNS_VERSION=1.3.4
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.3.3
|
||||
MOGO_PASSPORT_VERSION=1.3.4
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.3.3
|
||||
MOGO_SOCKET_VERSION=1.3.4
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.3.3
|
||||
MOGO_REALTIME_VERSION=1.3.4
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.3.3
|
||||
MOGO_TANLU_VERSION=1.3.4
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.3.3
|
||||
MOGO_LIVE_VERSION=1.3.4
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.3.3
|
||||
MOGO_TRAFFICLIVE_VERSION=1.3.4
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.3.3
|
||||
MOGO_LOCATION_VERSION=1.3.4
|
||||
|
||||
Reference in New Issue
Block a user