14 行
464 B
Kotlin
14 行
464 B
Kotlin
|
|
package com.xuqm.sdk.log
|
||
|
|
|
||
|
|
import com.xuqm.sdk.log.internal.LogStorage
|
||
|
|
|
||
|
|
internal object CrashCapture {
|
||
|
|
fun start(logApiUrl: String, appKey: String, getUserId: () -> String?) {
|
||
|
|
val prev = Thread.getDefaultUncaughtExceptionHandler()
|
||
|
|
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
||
|
|
LogStorage.saveCrash(throwable, logApiUrl, appKey, getUserId())
|
||
|
|
prev?.uncaughtException(thread, throwable)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|