Commit cb4f68c6 by 刘鹏

feat: net阿里云埋点增加方法,platform增加丰富参数埋点,方便后续定位问题

parent 8d64a578
...@@ -33,6 +33,8 @@ import kotlinx.android.synthetic.main.activity_main.* ...@@ -33,6 +33,8 @@ import kotlinx.android.synthetic.main.activity_main.*
import com.ydl.component.route.PlatformTempCommonRouteImpl import com.ydl.component.route.PlatformTempCommonRouteImpl
import com.ydl.confide.home.ConfideHomeActivity import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.ydlcommon.router.YdlCommonRouterManager import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
import com.yidianling.user.StatusUtils import com.yidianling.user.StatusUtils
...@@ -89,6 +91,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -89,6 +91,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
tv_home?.setOnClickListener { tv_home?.setOnClickListener {
mPresenter.loadHome() mPresenter.loadHome()
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.LOGIN,"测试测试啊")
} }
bt_to_other.setOnClickListener { bt_to_other.setOnClickListener {
......
...@@ -5,7 +5,7 @@ ext { ...@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.04", "m-confide" : "0.0.49.05",
"m-consultant" : "0.0.59.68", "m-consultant" : "0.0.59.68",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.24", "m-user" : "0.0.61.24",
...@@ -39,12 +39,12 @@ ext { ...@@ -39,12 +39,12 @@ ext {
"ydl-webview" : "0.0.38.38", "ydl-webview" : "0.0.38.38",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.16", "ydl-pay" : "0.0.18.16",
"m-audioim" : "0.0.49.29.33", "m-audioim" : "0.0.49.29.34",
"ydl-flutter-base": "0.0.14.20", "ydl-flutter-base": "0.0.14.20",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.6", "ydl-net" : "0.0.3.8",
"ydl-utils" : "0.0.3.1", "ydl-utils" : "0.0.3.1",
] ]
ydl_app = [ ydl_app = [
...@@ -121,12 +121,12 @@ ext { ...@@ -121,12 +121,12 @@ ext {
"ydl-webview" : "0.0.38.38", "ydl-webview" : "0.0.38.38",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.16", "ydl-pay" : "0.0.18.16",
"m-audioim" : "0.0.49.29.33", "m-audioim" : "0.0.49.29.34",
"ydl-flutter-base": "0.0.14.20", "ydl-flutter-base": "0.0.14.20",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.6", "ydl-net" : "0.0.3.8",
"ydl-utils" : "0.0.3.1", "ydl-utils" : "0.0.3.1",
] ]
......
package com.ydl.ydlnet.utils.log package com.ydl.ydlnet.utils.log
import android.util.Log
import com.aliyun.sls.android.producer.* import com.aliyun.sls.android.producer.*
class AliYunLogHelper { class AliYunLogHelper {
...@@ -43,7 +42,15 @@ class AliYunLogHelper { ...@@ -43,7 +42,15 @@ class AliYunLogHelper {
log.putContent(key, value) log.putContent(key, value)
if (mClient != null) { if (mClient != null) {
val res: LogProducerResult = mClient!!.addLog(log) val res: LogProducerResult = mClient!!.addLog(log)
Log.d("LogProducerResult", String.format("%s %s", res, res.isLogProducerResultOk)) }
}
/**
* @param log 子类调用,传递更多参数
* */
fun sendLog(log: Log) {
if (mClient != null) {
val res: LogProducerResult = mClient!!.addLog(log)
} }
} }
} }
\ No newline at end of file
package com.ydl.ydlcommon.utils.log
import com.aliyun.sls.android.producer.Log
import com.ydl.ydlcommon.base.BaseApp.Companion.getApp
import com.ydl.ydlcommon.data.PlatformDataManager.getRam
import com.ydl.ydlcommon.modular.ModularServiceManager.getPlatformUserService
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
/**
* @author liupeng
*
* 阿里云埋点,携带基本参数,方便后续排查问题定位
* */
class AliYunRichLogsHelper {
companion object {
fun getInstance(): AliYunRichLogsHelper {
return Holder.INSTANCE
}
}
private object Holder {
val INSTANCE = AliYunRichLogsHelper()
}
/**
*
* @param key AliYunLogConfig 接口、登录、声网、WebView、支付、其他
* @param value 具体的状态值
* */
fun sendRichLog(key: String, value: String) {
val log = Log()
val userInfo = getPlatformUserService()!!.getUser()
log.putContent(key, value)
log.putContent("ffrom", getRam().getChannelName())
log.putContent("isFromApp", "1")
log.putContent("osBuild", RxDeviceTool.getBuildBrandModel())
log.putContent(RxDeviceTool.getSDKVersionName(), RxAppTool.getAppVersionName(getApp()))
log.putContent("version", RxAppTool.getAppVersionName(getApp()))
if (null != userInfo) {
log.putContent("uid", userInfo.userId)
log.putContent("accessToken", userInfo.token)
}
AliYunLogHelper.getInstance().sendLog(log)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment