|
@@ -3,6 +3,8 @@ package io.legado.app.constant
|
|
|
import android.util.Log
|
|
import android.util.Log
|
|
|
import io.legado.app.BuildConfig
|
|
import io.legado.app.BuildConfig
|
|
|
import io.legado.app.help.config.AppConfig
|
|
import io.legado.app.help.config.AppConfig
|
|
|
|
|
+import io.legado.app.utils.toastOnUi
|
|
|
|
|
+import splitties.init.appCtx
|
|
|
|
|
|
|
|
object AppLog {
|
|
object AppLog {
|
|
|
|
|
|
|
@@ -11,8 +13,11 @@ object AppLog {
|
|
|
val logs get() = mLogs.toList()
|
|
val logs get() = mLogs.toList()
|
|
|
|
|
|
|
|
@Synchronized
|
|
@Synchronized
|
|
|
- fun put(message: String?, throwable: Throwable? = null) {
|
|
|
|
|
|
|
+ fun put(message: String?, throwable: Throwable? = null, toast: Boolean = false) {
|
|
|
message ?: return
|
|
message ?: return
|
|
|
|
|
+ if (toast) {
|
|
|
|
|
+ appCtx.toastOnUi(message)
|
|
|
|
|
+ }
|
|
|
if (mLogs.size > 100) {
|
|
if (mLogs.size > 100) {
|
|
|
mLogs.removeLastOrNull()
|
|
mLogs.removeLastOrNull()
|
|
|
}
|
|
}
|
|
@@ -29,7 +34,7 @@ object AppLog {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fun putDebug(message: String?, throwable: Throwable? = null) {
|
|
fun putDebug(message: String?, throwable: Throwable? = null) {
|
|
|
- if (AppConfig.recordLog || BuildConfig.DEBUG) {
|
|
|
|
|
|
|
+ if (AppConfig.recordLog) {
|
|
|
put(message, throwable)
|
|
put(message, throwable)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|