[Change]
增加对网络日志的动态管理
This commit is contained in:
@@ -51,6 +51,8 @@ public class MoGoApplication extends MultiDexApplication {
|
||||
clientConfig.setThirdLogin(true);
|
||||
// 设置是否输出日志
|
||||
clientConfig.setShowDebugLog(true);
|
||||
// 设置是否输出网络日志
|
||||
clientConfig.setShowNetDebugLog(true);
|
||||
// 设置是否是直播推流的主播 true-主播,false-观众
|
||||
clientConfig.setAnchor(false);
|
||||
// 设置从蘑菇AI开放平台获取的APPKey
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
/**
|
||||
* 网络请求配置
|
||||
*/
|
||||
public class NetWorkConfig {
|
||||
// 是否打印 Log信息
|
||||
public static boolean isPrintLog = false;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.cloud.network.interceptor
|
||||
|
||||
import com.elegant.log.simplelog.Logger
|
||||
import com.mogo.cloud.network.NetConstants.Companion.TAG
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import okhttp3.*
|
||||
import okio.Buffer
|
||||
import java.io.IOException
|
||||
@@ -84,7 +85,9 @@ class HttpLoggingInterceptor : Interceptor {
|
||||
if (response.code() != 200) {
|
||||
Logger.e(TAG, logMsg.toString())
|
||||
} else {
|
||||
//Logger.d(TAG, logMsg.toString())
|
||||
if (MoGoAiCloudClientConfig.getInstance().isShowNetDebugLog) {
|
||||
Logger.d(TAG, logMsg.toString())
|
||||
}
|
||||
}
|
||||
return if (consumedResponse) response.newBuilder()
|
||||
.body(ResponseBody.create(contentType, responseContent)).build() else response
|
||||
|
||||
@@ -65,6 +65,12 @@ public class MoGoAiCloudClientConfig {
|
||||
* 是否打印日志
|
||||
*/
|
||||
private boolean isShowDebugLog = false;
|
||||
|
||||
/**
|
||||
* 是否打印网络日志
|
||||
*/
|
||||
private boolean isShowNetDebugLog = false;
|
||||
|
||||
/**
|
||||
* 是否Toast日志
|
||||
*/
|
||||
@@ -301,6 +307,15 @@ public class MoGoAiCloudClientConfig {
|
||||
return isShowDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否打印网络日志
|
||||
*
|
||||
* @return true-打印日志,false-不打印日志
|
||||
*/
|
||||
public boolean isShowNetDebugLog() {
|
||||
return isShowNetDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否打印日志
|
||||
*
|
||||
@@ -321,6 +336,15 @@ public class MoGoAiCloudClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否打印网络日志
|
||||
*
|
||||
* @param showNetDebugLog true-打印日志,false-不打印日志
|
||||
*/
|
||||
public void setShowNetDebugLog(boolean showNetDebugLog) {
|
||||
isShowNetDebugLog = showNetDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否打Toast日志
|
||||
*
|
||||
|
||||
@@ -33,7 +33,7 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
|
||||
USERNAME=xintai
|
||||
PASSWORD=xintai2018
|
||||
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
||||
RELEASE=true
|
||||
RELEASE=false
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.3.54
|
||||
|
||||
Reference in New Issue
Block a user