|
@@ -10,6 +10,7 @@ import android.content.res.Configuration
|
|
|
import android.os.Build
|
|
import android.os.Build
|
|
|
import com.github.liuyueyi.quick.transfer.constants.TransType
|
|
import com.github.liuyueyi.quick.transfer.constants.TransType
|
|
|
import com.jeremyliao.liveeventbus.LiveEventBus
|
|
import com.jeremyliao.liveeventbus.LiveEventBus
|
|
|
|
|
+import com.jeremyliao.liveeventbus.logger.DefaultLogger
|
|
|
import io.legado.app.base.AppContextWrapper
|
|
import io.legado.app.base.AppContextWrapper
|
|
|
import io.legado.app.constant.AppConst.channelIdDownload
|
|
import io.legado.app.constant.AppConst.channelIdDownload
|
|
|
import io.legado.app.constant.AppConst.channelIdReadAloud
|
|
import io.legado.app.constant.AppConst.channelIdReadAloud
|
|
@@ -40,6 +41,7 @@ import splitties.init.appCtx
|
|
|
import splitties.systemservices.notificationManager
|
|
import splitties.systemservices.notificationManager
|
|
|
import java.net.URL
|
|
import java.net.URL
|
|
|
import java.util.concurrent.TimeUnit
|
|
import java.util.concurrent.TimeUnit
|
|
|
|
|
+import java.util.logging.Level
|
|
|
|
|
|
|
|
class App : Application() {
|
|
class App : Application() {
|
|
|
|
|
|
|
@@ -57,6 +59,7 @@ class App : Application() {
|
|
|
.lifecycleObserverAlwaysActive(true)
|
|
.lifecycleObserverAlwaysActive(true)
|
|
|
.autoClear(false)
|
|
.autoClear(false)
|
|
|
.enableLogger(BuildConfig.DEBUG || AppConfig.recordLog)
|
|
.enableLogger(BuildConfig.DEBUG || AppConfig.recordLog)
|
|
|
|
|
+ .setLogger(EventLogger())
|
|
|
applyDayNight(this)
|
|
applyDayNight(this)
|
|
|
registerActivityLifecycleCallbacks(LifecycleHelp)
|
|
registerActivityLifecycleCallbacks(LifecycleHelp)
|
|
|
defaultSharedPreferences.registerOnSharedPreferenceChangeListener(AppConfig)
|
|
defaultSharedPreferences.registerOnSharedPreferenceChangeListener(AppConfig)
|
|
@@ -178,4 +181,21 @@ class App : Application() {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ class EventLogger : DefaultLogger() {
|
|
|
|
|
+
|
|
|
|
|
+ override fun log(level: Level, msg: String) {
|
|
|
|
|
+ super.log(level, msg)
|
|
|
|
|
+ LogUtils.d(TAG, msg)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ override fun log(level: Level, msg: String, th: Throwable?) {
|
|
|
|
|
+ super.log(level, msg, th)
|
|
|
|
|
+ LogUtils.d(TAG, "$msg\n${th?.stackTraceToString()}")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ companion object {
|
|
|
|
|
+ private const val TAG = "[LiveEventBus]"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|