chore(bugcollect): 清理调试日志,准备发布正式版本

这个提交包含在:
XuqmGroup 2026-06-18 21:15:55 +08:00
父节点 84c9eb5e7a
当前提交 ffafd94a1e
共有 3 个文件被更改,包括 5 次插入17 次删除

查看文件

@ -88,12 +88,10 @@ object BugCollect {
)
if (!isReady()) {
synchronized(pendingErrorsLock) { pendingErrors.add(event) }
android.util.Log.d("BugCollect", "captureError: SDK not ready, queued (${pendingErrors.size} pending)")
return
}
flushPendingErrors()
queue().push(event)
android.util.Log.d("BugCollect", "captureError: pushed to queue")
}
fun captureCrash(error: Throwable, tags: Map<String, Any?> = emptyMap()) {
@ -154,7 +152,6 @@ 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,
@ -183,7 +180,6 @@ object BugCollect {
pendingErrors.clear()
list
}
android.util.Log.d("BugCollect", "flushPendingErrors: ${events.size} events")
events.forEach { queue().push(it) }
}

查看文件

@ -111,10 +111,7 @@ internal class LogQueue(
private fun flush() {
// URL 未就绪时跳过,等下次定时 flush
if (logApiUrl.isBlank()) {
Log.d(TAG, "flush: URL blank, skipping")
return
}
if (logApiUrl.isBlank()) return
val issues: List<IssueEvent>
val events: List<LogEvent>
synchronized(lock) {
@ -124,7 +121,6 @@ internal class LogQueue(
pendingIssues.clear()
pendingEvents.clear()
}
Log.d(TAG, "flush: uploading ${issues.size} issues, ${events.size} events, url=$logApiUrl")
if (issues.isNotEmpty()) {
scope.launch {
runCatching { LogUploader.uploadIssues(logApiUrl, issues) }

查看文件

@ -38,7 +38,6 @@ 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}, thread=${Thread.currentThread().name}")
val envelope = createEnvelope()
val events = JSONArray()
for (issue in issues) {
@ -79,17 +78,14 @@ 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()
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)
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) {
Log.w(TAG, "Upload failed: HTTP ${response.code} url=$url")
}
}
}