[6.1.0] feat:taxi无人化司机端 无人化运营流程关键节点日志 通过埋点上传大数据;

This commit is contained in:
aibingbing
2023-09-19 12:49:29 +08:00
parent 6c0d8b58fe
commit 4ce0854522

View File

@@ -13,7 +13,10 @@ import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.eagle.core.function.main.MainMoGoApplication
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
@@ -43,6 +46,8 @@ import kotlinx.android.synthetic.main.taxi_debug_order.view.orderStartSiteInfo
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderStatus
import kotlinx.android.synthetic.main.taxi_debug_order.view.taskEndSite
import kotlinx.android.synthetic.main.taxi_debug_order.view.taskStartSite
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
public class DebugView @JvmOverloads constructor(
@@ -50,20 +55,25 @@ public class DebugView @JvmOverloads constructor(
) : LinearLayout(context, attrs, defStyleAttr, defStyleRes), ITaxiTaskWithOrderCallback {
companion object {
const val TAG = "DebugView"
private const val ANALYTICS_EVENT_TYPE_DRIVER_UNMANNED_OPERATION_PROCESS_KEY_NODE_LOG =
"och.driver.unmanned.operation.process.key.node.log"
const val BROADCAST_ACTION = "com.mogo.och.driver.debugview.show"
const val BROADCAST_DATA_SHOW = "isShow"
private var logHistoryTextView: TextView? = null
fun printInfoMsg(msg: String) {
printMsg("Info $msg", MainMoGoApplication.getApp().getColor(R.color.background_info))
trackEvent("Info", msg)
}
fun printWarnMsg(msg: String) {
printMsg("Warn $msg", MainMoGoApplication.getApp().getColor(R.color.background_warn))
trackEvent("Warn", msg)
}
fun printErrorMsg(msg: String) {
printMsg("Error $msg", MainMoGoApplication.getApp().getColor(R.color.background_error))
trackEvent("Error", msg)
}
private fun printMsg(msg: String, textColor: Int) {
@@ -86,6 +96,18 @@ public class DebugView @JvmOverloads constructor(
}
}
/**
* 上报埋点
*/
private fun trackEvent(level: String, msg: String) {
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.IO) {
val map: MutableMap<String, Any> = HashMap()
map["level"] = level
map["msg"] = msg
MogoAnalyticUtils.track(ANALYTICS_EVENT_TYPE_DRIVER_UNMANNED_OPERATION_PROCESS_KEY_NODE_LOG, map)
}
}
private fun currentDateTimeString(): String {
return DateTimeUtil.formatCalendarToString(
DateTimeUtil.formatLongToCalendar(System.currentTimeMillis()),