From 501dac9e557a5f196009e58d74ea002091c88ea2 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Fri, 19 Nov 2021 16:16:11 +0800 Subject: [PATCH] =?UTF-8?q?[Upload]=E7=BD=91=E7=BB=9C=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=88=86=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/git_toolbox_prj.xml | 15 +++++++ .../interceptor/HttpLoggingInterceptor.kt | 44 +++++++++++-------- gradle.properties | 20 ++++----- 3 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 .idea/git_toolbox_prj.xml diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..b382006 --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/foudations/mogo-network/src/main/java/com/mogo/cloud/network/interceptor/HttpLoggingInterceptor.kt b/foudations/mogo-network/src/main/java/com/mogo/cloud/network/interceptor/HttpLoggingInterceptor.kt index 5a2b7bd..5e18166 100644 --- a/foudations/mogo-network/src/main/java/com/mogo/cloud/network/interceptor/HttpLoggingInterceptor.kt +++ b/foudations/mogo-network/src/main/java/com/mogo/cloud/network/interceptor/HttpLoggingInterceptor.kt @@ -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 } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a5baecc..7dea2a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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