[fea]
接口日志添加tag
This commit is contained in:
yakunyang
2024-06-14 18:20:23 +08:00
parent 756e6d8d0e
commit 33ef830289

View File

@@ -18,10 +18,12 @@ class OchCommonSubscribeImpl<T : BaseData>(
const val TAG = "OchCommonSubscribeImpl"
}
private var tag:Long = System.currentTimeMillis()
init {
CallerLogger.e("$flavorTag$TAG", "$apiName: 去请求()")
if(writeLog) {
OchChainLogManager.writeChainLogNet("接口:${apiName}", "去请求")
OchChainLogManager.writeChainLogNet("接口:${apiName}_${tag}", "去请求")
}
}
@@ -29,7 +31,7 @@ class OchCommonSubscribeImpl<T : BaseData>(
super.onSuccess(o)
CallerLogger.d("$flavorTag$TAG", "$apiName: onSuccess() ${o.msg}")
if(writeLog) {
OchChainLogManager.writeChainLogNet("接口:${apiName}", "请求成功:${o}")
OchChainLogManager.writeChainLogNet("接口:${apiName}_${tag}", "请求成功:${o}")
}
callback?.onSuccess(o)
}
@@ -38,7 +40,7 @@ class OchCommonSubscribeImpl<T : BaseData>(
super.onError(e)
CallerLogger.e("$flavorTag$TAG", "$apiName: onError() ${e.message}")
if(writeLog) {
OchChainLogManager.writeChainLogNet("接口:${apiName}", "请求失败:${e.message}")
OchChainLogManager.writeChainLogNet("接口:${apiName}_${tag}", "请求失败:${e.message}")
}
callback?.onError("$apiName: onError() ${e.message}")
callback?.onError()
@@ -49,7 +51,7 @@ class OchCommonSubscribeImpl<T : BaseData>(
CallerLogger.e("$flavorTag$TAG", "$apiName: onError() code = $code; message = $message")
if(writeLog) {
OchChainLogManager.writeChainLogNet(
"接口:${apiName}",
"接口:${apiName}_${tag}",
"请求失败: onError() code = $code; message = $message\""
)
}