From 10ff1c2e877e264954a5ed2e77b773fca212da84 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Wed, 2 Mar 2022 13:25:02 +0800 Subject: [PATCH] fix bug of log switch --- .../logcatch/MogoLogCatchManager.kt | 15 ++++++--------- .../function/hmi/ui/setting/DebugSettingView.kt | 6 +++++- gradle.properties | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt index bb533a117f..8fe746db86 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt @@ -11,7 +11,6 @@ import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager -import com.mogo.eagle.core.network.NetConfig import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr @@ -82,7 +81,7 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl return false } - fun startCatchLog(duration:Int = 10) { + fun startCatchLog(duration: Int = 10) { if (catchingList.contains(MANUAL_CATCH_PKG_NAME)) { TipToast.shortTip("已经在抓取日志了,请稍后再试") } else { @@ -156,13 +155,11 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl * 根据状态收紧Logger的限制 */ private fun closeLoggerLevel() { - if (catchingList.isNotEmpty()) { - LogUtils.getConfig().isLogSwitch = false - Logger.init(if (DebugConfig.isDebug()) LogLevel.DEBUG else LogLevel.OFF) - MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false - CallerAutoPilotManager.setEnableLog(false) - CallerAutoPilotManager.setIsWriteLog(false) - } + LogUtils.getConfig().isLogSwitch = false + Logger.init(if (DebugConfig.isDebug()) LogLevel.DEBUG else LogLevel.OFF) + MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false + CallerAutoPilotManager.setEnableLog(false) + CallerAutoPilotManager.setIsWriteLog(false) } override fun onError(errorCount: Int) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index e5292b1f22..358b8c8a73 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -393,7 +393,11 @@ class DebugSettingView @JvmOverloads constructor( SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false) tbLogCatch.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { - val logCatchTime = etLogCatch.text.toString().toInt() + var logTimeStr = etLogCatch.text?.toString() + if(logTimeStr.isNullOrEmpty()){ + logTimeStr = "10" + } + val logCatchTime = logTimeStr.toInt() if (logCatchTime > 60) { tbLogCatch.isChecked = false TipToast.shortTip("最长抓取时间为60分钟") diff --git a/gradle.properties b/gradle.properties index e02d998e25..82d28a9877 100644 --- a/gradle.properties +++ b/gradle.properties @@ -60,7 +60,7 @@ HOOK_LOG_VERSION=1.5.17 SERVICE_CHAIN_VERSION=1.0.53 ################ 外部依赖引用 ################ # loglib -LOGLIB_VERSION=1.2.8 +LOGLIB_VERSION=1.2.9 ######## MogoAiCloudSDK Version ######## # 网络请求 MOGO_NETWORK_VERSION=1.3.31