Merge branch 'dev_robotaxi-d-app-module_260_220304_2.6.0_all_pb' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_260_220304_2.6.0_all_pb

This commit is contained in:
xinfengkun
2022-03-15 10:59:21 +08:00
4 changed files with 23 additions and 17 deletions

View File

@@ -105,7 +105,7 @@ class CronTaskManager(private var context: Context?) {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
cameraList = it cameraList = it
CallerLogger.d("$M_MONITOR$TAG", "requestDeviceList返回结果为$it") // CallerLogger.d("$M_MONITOR$TAG", "requestDeviceList返回结果为$it")
}, { }, {
it.printStackTrace() it.printStackTrace()
CallerLogger.e( CallerLogger.e(
@@ -138,7 +138,7 @@ class CronTaskManager(private var context: Context?) {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
carCameraList = it carCameraList = it
CallerLogger.d("$M_MONITOR$TAG", "requestCarCameraList返回结果为$it") // CallerLogger.d("$M_MONITOR$TAG", "requestCarCameraList返回结果为$it")
}, { }, {
CallerLogger.e( CallerLogger.e(
"$M_MONITOR$TAG", "$M_MONITOR$TAG",

View File

@@ -4,27 +4,27 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.Scene.Companion.scene
object CallerLogger { object CallerLogger {
fun i(tag: String, message: String) { fun i(tag: String, message: Any? = null) {
if (scene.check(tag)) { if (scene.check(tag)) {
Logger.i(tag, message, null) Logger.i(tag, message.toString(), null)
} }
} }
fun d(tag: String, message: String) { fun d(tag: String, message: Any? = null) {
if (scene.check(tag)) { if (scene.check(tag)) {
Logger.d(tag, message, null) Logger.d(tag, message.toString(), null)
} }
} }
fun w(tag: String, message: String) { fun w(tag: String, message: Any? = null) {
if (scene.check(tag)) { if (scene.check(tag)) {
Logger.w(tag, message, null) Logger.w(tag, message.toString(), null)
} }
} }
fun e(tag: String, message: String) { fun e(tag: String, message: Any? = null) {
if (scene.check(tag)) { if (scene.check(tag)) {
Logger.e(tag, message, null) Logger.e(tag, message.toString(), null)
} }
} }

View File

@@ -8,6 +8,9 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OLD_ROUTE import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OLD_ROUTE
import java.util.* import java.util.*
/**
* 场景日志,提供场景过滤服务
*/
class Scene { class Scene {
companion object { companion object {
@@ -40,11 +43,16 @@ class Scene {
//初始化其他模块,方便定位索引 //初始化其他模块,方便定位索引
val otherMap = SceneLogCache(mutableMapOf(), true) val otherMap = SceneLogCache(mutableMapOf(), true)
sceneCache[M_OTHER] = otherMap sceneCache[M_OTHER] = otherMap
//todo 1. SceneLogCache增加模块名称提供场景需要
//todo 2. 对特定场景提供数据, 网约车,调度...
} }
fun check(tag: String): Boolean { fun check(tag: String): Boolean {
return if (canLog()) { return if (canLog()) {
classifyLog(tag) // classifyLog(tag)
true
} else { } else {
false false
} }
@@ -76,15 +84,13 @@ class Scene {
return otherLogCache.logger return otherLogCache.logger
} }
if (businessName.isNullOrEmpty()) {
return false
}
//此处存在用户自定义方式,可根据过滤找到对应不符合标准的模块 //此处存在用户自定义方式,可根据过滤找到对应不符合标准的模块
var logCache = sceneCache[moduleName] var logCache = sceneCache[moduleName]
if (logCache == null) { if (logCache == null) {
logCache = SceneLogCache(mutableMapOf(), true) logCache = SceneLogCache(mutableMapOf(), true)
logCache.tagMap!![businessName] = true businessName?.let {
logCache.tagMap!![it] = true
}
} }
sceneCache[moduleName] = logCache sceneCache[moduleName] = logCache
return logCache.logger return logCache.logger

View File

@@ -25,6 +25,6 @@ class SceneConstant {
//旧module //旧module
const val M_OLD_ROUTE = "OLD-ROUTE-SERVICE_" const val M_OLD_ROUTE = "OLD-ROUTE-SERVICE_"
const val M_OLD_OTHER = "OLD-OTHER-SERVICE_" const val M_OLD_OTHER = "OLD-OTHER-SERVICE_"
const val M_OTHER = "ALL-MODULES_" const val M_OTHER = "ALL_OLD-MODULES_"
} }
} }