fix(bugcollect): 修复上传流程 - pendingErrors 队列、动态 URL、相对路径补全
这个提交包含在:
父节点
8d0dd0a41d
当前提交
84c9eb5e7a
@ -154,6 +154,7 @@ object BugCollect {
|
||||
if (crashCaptureStarted) return
|
||||
if (!XuqmSDK.isInitialized()) return
|
||||
crashCaptureStarted = true
|
||||
android.util.Log.w("BugCollect", "startCrashCapture: registering crash handler")
|
||||
CrashCapture.start(
|
||||
appContext = XuqmSDK.appContext,
|
||||
appKey = XuqmSDK.appKey,
|
||||
|
||||
@ -38,7 +38,7 @@ internal object LogUploader {
|
||||
fun uploadIssues(logApiUrl: String, issues: List<IssueEvent>) {
|
||||
if (issues.isEmpty()) return
|
||||
val url = "${resolveUrl(logApiUrl)}/bugcollect/v1/issues/batch"
|
||||
Log.w(TAG, "uploadIssues: url=$url, count=${issues.size}")
|
||||
Log.w(TAG, "uploadIssues: url=$url, count=${issues.size}, thread=${Thread.currentThread().name}")
|
||||
val envelope = createEnvelope()
|
||||
val events = JSONArray()
|
||||
for (issue in issues) {
|
||||
@ -79,14 +79,17 @@ internal object LogUploader {
|
||||
}
|
||||
|
||||
private fun post(url: String, body: String) {
|
||||
android.util.Log.w(TAG, "POST_START url=$url bodyLen=${body.length}")
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.post(body.toRequestBody(JSON_MEDIA))
|
||||
.build()
|
||||
client.newCall(request).execute().use { response ->
|
||||
if (!response.isSuccessful) {
|
||||
Log.w(TAG, "Upload failed: HTTP ${response.code} url=$url")
|
||||
}
|
||||
try {
|
||||
val response = client.newCall(request).execute()
|
||||
android.util.Log.w(TAG, "POST_DONE code=${response.code} url=$url")
|
||||
response.close()
|
||||
} catch (e: Exception) {
|
||||
android.util.Log.e(TAG, "POST_FAIL url=$url", e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户