Skip to content

Commit 146e3f4

Browse files
committed
日志打印拦截器不再判断是否是debug模式,默认都打印日志
1 parent adc4c31 commit 146e3f4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGE_lOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGE LOG
22

3+
### 1.5.1
4+
5+
+ 日志打印拦截器不再判断是否是debug模式,默认都打印日志
6+
37
### 1.5.0
48

59
+ 解决服务器返回异常错误码,data为null的问题

mvvm/src/main/java/com/catchpig/mvvm/network/manager/NetManager.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.catchpig.mvvm.network.manager
33
import com.catchpig.mvvm.entity.ServiceParam
44
import com.catchpig.mvvm.ksp.KotlinMvvmCompiler
55
import com.catchpig.mvvm.network.factory.SerializationConverterFactory
6-
import com.catchpig.utils.ext.logd
6+
import com.catchpig.utils.ext.logi
77
import okhttp3.OkHttpClient
88
import okhttp3.logging.HttpLoggingInterceptor
99
import retrofit2.Retrofit
@@ -80,15 +80,15 @@ class NetManager private constructor() {
8080
* 读取数据超时时间
8181
*/
8282
.readTimeout(serviceParam.readTimeout, TimeUnit.MILLISECONDS)
83+
val loggingInterceptor = HttpLoggingInterceptor {
84+
it.logi(TAG)
85+
}
86+
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY)
87+
builder = builder.addInterceptor(loggingInterceptor)
8388
if (debug && serviceParam.debug) {
8489
serviceParam.debugInterceptors.forEach {
8590
builder = builder.addInterceptor(it)
8691
}
87-
val loggingInterceptor = HttpLoggingInterceptor {
88-
it.logd(TAG)
89-
}
90-
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY)
91-
builder = builder.addInterceptor(loggingInterceptor)
9292
}
9393
if (sslParamMap.contains(serviceClass)) {
9494
val sslParam = sslParamMap[serviceClass]

0 commit comments

Comments
 (0)