Replace Timber with Square Logcat and make logging configurable (#6062)
* Replace Timber with Square Logcat * Configurable logger
This commit is contained in:
+3
-2
@@ -27,8 +27,9 @@ import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.getPreferenceKey
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import eu.kanade.tachiyomi.widget.TachiyomiTextInputEditText.Companion.setIncognito
|
||||
import timber.log.Timber
|
||||
import logcat.LogPriority
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
class SourcePreferencesController(bundle: Bundle? = null) :
|
||||
@@ -77,7 +78,7 @@ class SourcePreferencesController(bundle: Bundle? = null) :
|
||||
try {
|
||||
addPreferencesForSource(screen, source)
|
||||
} catch (e: AbstractMethodError) {
|
||||
Timber.e("Source did not implement [addPreferencesForSource]: ${source.name}")
|
||||
logcat(LogPriority.ERROR) { "Source did not implement [addPreferencesForSource]: ${source.name}" }
|
||||
}
|
||||
|
||||
manager.setPreferences(screen)
|
||||
|
||||
+3
-2
@@ -42,6 +42,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.ui.more.MoreController
|
||||
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||
import eu.kanade.tachiyomi.util.system.connectivityManager
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.view.inflate
|
||||
@@ -54,7 +55,7 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.drop
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import timber.log.Timber
|
||||
import logcat.LogPriority
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
/**
|
||||
@@ -405,7 +406,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||
* @param error the error received.
|
||||
*/
|
||||
fun onAddPageError(error: Throwable) {
|
||||
Timber.e(error)
|
||||
logcat(LogPriority.ERROR, error)
|
||||
val adapter = adapter ?: return
|
||||
adapter.onLoadMoreComplete(null)
|
||||
hideProgressBar()
|
||||
|
||||
+6
-5
@@ -37,6 +37,7 @@ import eu.kanade.tachiyomi.util.chapter.syncChaptersWithTrackServiceTwoWay
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
import eu.kanade.tachiyomi.util.lang.withUIContext
|
||||
import eu.kanade.tachiyomi.util.removeCovers
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
@@ -44,10 +45,10 @@ import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import logcat.LogPriority
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Date
|
||||
@@ -155,7 +156,7 @@ open class BrowseSourcePresenter(
|
||||
view.onAddPage(page, mangas)
|
||||
},
|
||||
{ _, error ->
|
||||
Timber.e(error)
|
||||
logcat(LogPriority.ERROR, error)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -221,7 +222,7 @@ open class BrowseSourcePresenter(
|
||||
view?.onMangaInitialized(it)
|
||||
}
|
||||
}
|
||||
.catch { e -> Timber.e(e) }
|
||||
.catch { e -> logcat(LogPriority.ERROR, e) }
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
@@ -239,7 +240,7 @@ open class BrowseSourcePresenter(
|
||||
manga.initialized = true
|
||||
db.insertManga(manga).executeAsBlocking()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e)
|
||||
logcat(LogPriority.ERROR, e)
|
||||
}
|
||||
return manga
|
||||
}
|
||||
@@ -282,7 +283,7 @@ open class BrowseSourcePresenter(
|
||||
syncChaptersWithTrackServiceTwoWay(db, db.getChapters(manga).executeAsBlocking(), track, service as TrackService)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.w(e, "Could not match manga: ${manga.title} with service $service")
|
||||
logcat(LogPriority.WARN, e) { "Could not match manga: ${manga.title} with service $service" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -16,12 +16,13 @@ import eu.kanade.tachiyomi.source.model.toSManga
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourcePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.runAsObservable
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import logcat.LogPriority
|
||||
import rx.Observable
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import rx.subjects.PublishSubject
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@@ -198,7 +199,7 @@ open class GlobalSearchPresenter(
|
||||
view.setItems(manga)
|
||||
},
|
||||
{ _, error ->
|
||||
Timber.e(error)
|
||||
logcat(LogPriority.ERROR, error)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -233,7 +234,7 @@ open class GlobalSearchPresenter(
|
||||
view?.onMangaInitialized(source, manga)
|
||||
},
|
||||
{ error ->
|
||||
Timber.e(error)
|
||||
logcat(LogPriority.ERROR, error)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user