Update XLog

This commit is contained in:
Jobobby04 2020-11-25 15:57:05 -05:00
parent fcc2b1773b
commit 643aa377bf
30 changed files with 79 additions and 89 deletions

View File

@ -315,7 +315,7 @@ dependencies {
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.3.0'
// Better logging (EH)
implementation 'com.elvishew:xlog:1.6.1'
implementation 'com.elvishew:xlog:1.7.1'
// Debug utils (EH)
final def debug_overlay_version = '1.1.3'

View File

@ -115,15 +115,15 @@ open class App : Application(), LifecycleObserver {
try {
SSLContext.getInstance("TLSv1.2")
} catch (e: NoSuchAlgorithmException) {
XLog.e("Could not install Android 7 broken SSL workaround!", e)
XLog.tag("Init").e("Could not install Android 7 broken SSL workaround!", e)
}
try {
ProviderInstaller.installIfNeeded(applicationContext)
} catch (e: GooglePlayServicesRepairableException) {
XLog.e("Could not install Android 7 broken SSL workaround!", e)
XLog.tag("Init").e("Could not install Android 7 broken SSL workaround!", e)
} catch (e: GooglePlayServicesNotAvailableException) {
XLog.e("Could not install Android 7 broken SSL workaround!", e)
XLog.tag("Init").e("Could not install Android 7 broken SSL workaround!", e)
}
}
}
@ -183,8 +183,8 @@ open class App : Application(), LifecycleObserver {
val logConfig = LogConfiguration.Builder()
.logLevel(logLevel)
.st(2)
.nb()
.disableStackTrace()
.disableBorder()
.build()
val printers = mutableListOf<Printer>(AndroidPrinter())
@ -227,8 +227,8 @@ open class App : Application(), LifecycleObserver {
*printers.toTypedArray()
)
XLog.d("Application booting...")
XLog.nst().d(
XLog.tag("Init").d("Application booting...")
XLog.tag("Init").disableStackTrace().d(
"App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE})\n" +
"Preview build: $syDebugVersion\n" +
"Android version: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT}) \n" +
@ -253,7 +253,7 @@ open class App : Application(), LifecycleObserver {
.install()
} catch (e: IllegalStateException) {
// Crashes if app is in background
XLog.e("Failed to initialize debug overlay, app in background?", e)
XLog.tag("Init").e("Failed to initialize debug overlay, app in background?", e)
}
}
}

View File

@ -462,7 +462,7 @@ class LibraryUpdateService(
db.insertTrack(track).executeAsBlocking()
}
} catch (e: Exception) {
XLog.e(e)
XLog.tag("LibraryUpdateService").e(e)
}
}
}

View File

@ -158,7 +158,7 @@ class ExtensionManager(
val blacklistEnabled = preferences.eh_enableSourceBlacklist().get()
return filter {
if (it.isBlacklisted(blacklistEnabled)) {
XLog.d("[EXH] Removing blacklisted extension: (name: %s, pkgName: %s)!", it.name, it.pkgName)
XLog.tag("ExtensionManager").d("Removing blacklisted extension: (name: %s, pkgName: %s)!", it.name, it.pkgName)
false
} else true
}
@ -336,7 +336,7 @@ class ExtensionManager(
private fun registerNewExtension(extension: Extension.Installed) {
// SY -->
if (extension.isBlacklisted()) {
XLog.d("[EXH] Removing blacklisted extension: (name: String, pkgName: %s)!", extension.name, extension.pkgName)
XLog.tag("ExtensionManager").d("Removing blacklisted extension: (name: String, pkgName: %s)!", extension.name, extension.pkgName)
return
}
// SY <--
@ -354,7 +354,7 @@ class ExtensionManager(
private fun registerUpdatedExtension(extension: Extension.Installed) {
// SY -->
if (extension.isBlacklisted()) {
XLog.d("[EXH] Removing blacklisted extension: (name: String, pkgName: %s)!", extension.name, extension.pkgName)
XLog.tag("ExtensionManager").d("Removing blacklisted extension: (name: String, pkgName: %s)!", extension.name, extension.pkgName)
return
}
// SY <--

View File

@ -114,7 +114,7 @@ open class SourceManager(private val context: Context) {
} else DELEGATED_SOURCES[sourceQName]
} else null
val newSource = if (source is HttpSource && delegate != null) {
XLog.d("[EXH] Delegating source: %s -> %s!", sourceQName, delegate.newSourceClass.qualifiedName)
XLog.tag("SourceManager").d("Delegating source: %s -> %s!", sourceQName, delegate.newSourceClass.qualifiedName)
val enhancedSource = EnhancedHttpSource(
source,
delegate.newSourceClass.constructors.find { it.parameters.size == 2 }!!.call(source, context)
@ -125,7 +125,7 @@ open class SourceManager(private val context: Context) {
} else source
if (source.id in BlacklistedSources.BLACKLISTED_EXT_SOURCES) {
XLog.d("[EXH] Removing blacklisted source: (id: %s, name: %s, lang: %s)!", source.id, source.name, (source as? CatalogueSource)?.lang)
XLog.tag("SourceManager").d("Removing blacklisted source: (id: %s, name: %s, lang: %s)!", source.id, source.name, (source as? CatalogueSource)?.lang)
return
}
// EXH <--

View File

@ -5,14 +5,12 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.ui.manga.MangaController
import exh.metadata.metadata.base.RaisedSearchMetadata
import exh.metadata.metadata.base.getFlatMetadataForManga
import exh.metadata.metadata.base.insertFlatMetadata
import exh.source.EnhancedHttpSource
import rx.Completable
import rx.Single
import uy.kohesive.injekt.Injekt
@ -49,7 +47,7 @@ interface MetadataSource<M : RaisedSearchMetadata, I> : CatalogueSource {
* Will also save the metadata to the DB if possible
*/
fun parseToManga(manga: SManga, input: I): Completable {
val mangaId = (manga as? Manga)?.id
val mangaId = manga.id
val metaObservable = if (mangaId != null) {
// We have to use fromCallable because StorIO messes up the thread scheduling if we use their rx functions
Single.fromCallable {
@ -109,17 +107,4 @@ interface MetadataSource<M : RaisedSearchMetadata, I> : CatalogueSource {
val SManga.id get() = (this as? Manga)?.id
val SChapter.mangaId get() = (this as? Chapter)?.manga_id
companion object {
fun Source.isMetadataSource() = (this is MetadataSource<*, *> || (this is EnhancedHttpSource && this.enhancedSource is MetadataSource<*, *>))
fun Source.getMetadataSource(): MetadataSource<*, *>? {
return when {
!this.isMetadataSource() -> null
this is MetadataSource<*, *> -> this
this is EnhancedHttpSource && this.enhancedSource is MetadataSource<*, *> -> this.enhancedSource
else -> null
}
}
}
}

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.source.online.all
import android.content.Context
import android.net.Uri
import androidx.core.net.toUri
import com.elvishew.xlog.XLog
import eu.kanade.tachiyomi.annoations.Nsfw
import eu.kanade.tachiyomi.data.database.models.Manga
@ -313,7 +314,7 @@ class EHentai(
url = EHentaiSearchMetadata.normalizeUrl(parentLink)
} else break
} else {
XLog.d("Parent cache hit: %s!", gid)
XLog.tag("EHentai").d("Parent cache hit: %s!", gid)
url = EHentaiSearchMetadata.idAndTokenToUrl(
cachedParent.gId,
cachedParent.gToken
@ -412,7 +413,7 @@ class EHentai(
}
private fun searchMangaRequestObservable(page: Int, query: String, filters: FilterList): Observable<Request> {
val uri = Uri.parse("$baseUrl$QUERY_PREFIX").buildUpon()
val uri = "$baseUrl$QUERY_PREFIX".toUri().buildUpon()
uri.appendQueryParameter("f_search", (query + " " + combineQuery(filters)).trim())
filters.forEach {
@ -576,7 +577,7 @@ class EHentai(
lastUpdateCheck - datePosted!! > EHentaiUpdateWorkerConstants.GALLERY_AGE_TIME
) {
aged = true
XLog.d("aged %s - too old", title)
XLog.tag("EHentai").d("aged %s - too old", title)
}
// Parse ratings
@ -723,7 +724,7 @@ class EHentai(
// Headers
override fun headersBuilder() = super.headersBuilder().add("Cookie", cookiesHeader())
private fun addParam(url: String, param: String, value: String) = Uri.parse(url)
private fun addParam(url: String, param: String, value: String) = url.toUri()
.buildUpon()
.appendQueryParameter(param, value)
.toString()
@ -842,7 +843,7 @@ class EHentai(
stringBuilder.append(" ")
}
XLog.d(stringBuilder.toString())
XLog.tag("EHentai").d(stringBuilder.toString())
return stringBuilder.toString().trim()
}

View File

@ -179,7 +179,7 @@ class MergedSource : SuspendHttpSource() {
reference.mangaId = manga.id
db.insertNewMergedMangaId(reference).await()
} catch (e: Exception) {
XLog.st(e.stackTrace.contentToString(), 5)
XLog.tag("MergedSource").enableStackTrace(e.stackTrace.contentToString(), 5)
}
}
return LoadedMangaSource(source, manga, reference)

View File

@ -538,8 +538,8 @@ open class BrowseSourceController(bundle: Bundle) :
*/
/* SY --> */ open /* SY <-- */fun onAddPageError(error: Throwable) {
// SY -->
XLog.w("> Failed to load next catalogue page!", error)
XLog.w(
XLog.tag("BrowseSourceController").enableStackTrace(2).w("> Failed to load next catalogue page!", error)
XLog.tag("BrowseSourceController").enableStackTrace(2).w(
"> (source.id: %s, source.name: %s)",
presenter.source.id,
presenter.source.name

View File

@ -97,7 +97,7 @@ open class AutoComplete(val filter: Filter.AutoComplete) : AbstractFlexibleItem<
addChipToGroup(name, holder)
filter.state += name
} else {
XLog.d("Invalid tag: $name")
XLog.tag("AutoComplete").d("Invalid tag: $name")
}
}

View File

@ -48,9 +48,9 @@ class BiometricTimesCreateDialog<T>(bundle: Bundle? = null) : DialogController(b
.title(if (startTime == null) R.string.biometric_lock_start_time else R.string.biometric_lock_end_time)
.timePicker(show24HoursView = false) { _, datetime ->
val hour = datetime.get(Calendar.HOUR_OF_DAY)
XLog.nst().d(hour)
XLog.disableStackTrace().d(hour)
val minute = datetime.get(Calendar.MINUTE)
XLog.nst().d(minute)
XLog.disableStackTrace().d(minute)
if (hour !in 0..24 || minute !in 0..60) return@timePicker
if (startTime != null) {
endTime = hour.hours + minute.minutes

View File

@ -41,7 +41,7 @@ class BiometricTimesPresenter : BasePresenter<BiometricTimesController>() {
preferences.biometricTimeRanges().asFlow().onEach { prefTimeRanges ->
timeRanges = prefTimeRanges.toList()
.mapNotNull { TimeRange.fromPreferenceString(it) }.onEach { XLog.nst().d(it) }
.mapNotNull { TimeRange.fromPreferenceString(it) }.onEach { XLog.disableStackTrace().d(it) }
Observable.just(timeRanges)
.map { it.map(::BiometricTimesItem) }
@ -62,7 +62,7 @@ class BiometricTimesPresenter : BasePresenter<BiometricTimesController>() {
return
}
XLog.nst().d(timeRange)
XLog.disableStackTrace().d(timeRange)
preferences.biometricTimeRanges() += timeRange.toPreferenceString()
}

View File

@ -74,7 +74,7 @@ class EditMergedSettingsHeaderAdapter(private val controller: EditMergedSettings
3 -> MergedMangaReference.CHAPTER_SORT_HIGHEST_CHAPTER_NUMBER
else -> MergedMangaReference.CHAPTER_SORT_NO_DEDUPE
}
XLog.nst().d(controller.mergeReference?.chapterSortMode)
XLog.d(controller.mergeReference?.chapterSortMode)
editMergedMangaItemSortingListener.onSetPrioritySort(canMove())
}

View File

@ -319,7 +319,7 @@ object EXHMigrations {
try {
dbLocation.copyTo(backupLocation, overwrite = true)
} catch (t: Throwable) {
XLog.w("Failed to backup database!")
logger.enableStackTrace(2).w("Failed to backup database!")
}
}

View File

@ -22,6 +22,8 @@ class GalleryAdder {
private val sourceManager: SourceManager by injectLazy()
private val logger = XLog.tag("GalleryAdder").enableStackTrace(2).build()
fun pickSource(url: String): List<UrlImportableSource> {
val uri = url.toUri()
return sourceManager.getVisibleCatalogueSources()
@ -43,7 +45,7 @@ class GalleryAdder {
forceSource: UrlImportableSource? = null,
throttleFunc: () -> Unit = {}
): GalleryAddEvent {
XLog.d(context.getString(R.string.gallery_adder_importing_manga, url, fav.toString(), forceSource))
logger.d(context.getString(R.string.gallery_adder_importing_manga, url, fav.toString(), forceSource))
try {
val uri = url.toUri()
@ -53,7 +55,7 @@ class GalleryAdder {
if (forceSource.matchesUri(uri)) forceSource
else return GalleryAddEvent.Fail.UnknownType(url, context)
} catch (e: Exception) {
XLog.e(context.getString(R.string.gallery_adder_source_uri_must_match), e)
logger.e(context.getString(R.string.gallery_adder_source_uri_must_match), e)
return GalleryAddEvent.Fail.UnknownType(url, context)
}
} else {
@ -73,7 +75,7 @@ class GalleryAdder {
val realUrl = try {
source.mapUrlToMangaUrl(uri)
} catch (e: Exception) {
XLog.e(context.getString(R.string.gallery_adder_uri_map_to_manga_error), e)
logger.e(context.getString(R.string.gallery_adder_uri_map_to_manga_error), e)
null
} ?: return GalleryAddEvent.Fail.UnknownType(url, context)
@ -81,7 +83,7 @@ class GalleryAdder {
val cleanedUrl = try {
source.cleanMangaUrl(realUrl)
} catch (e: Exception) {
XLog.e(context.getString(R.string.gallery_adder_uri_clean_error), e)
logger.e(context.getString(R.string.gallery_adder_uri_clean_error), e)
null
} ?: return GalleryAddEvent.Fail.UnknownType(url, context)
@ -125,13 +127,13 @@ class GalleryAdder {
} else emptyList<Chapter>() to emptyList()
}.awaitSingle()
} catch (e: Exception) {
XLog.w(context.getString(R.string.gallery_adder_chapter_fetch_error, manga.title), e)
logger.w(context.getString(R.string.gallery_adder_chapter_fetch_error, manga.title), e)
return GalleryAddEvent.Fail.Error(url, context.getString(R.string.gallery_adder_chapter_fetch_error, url))
}
return GalleryAddEvent.Success(url, manga, context)
} catch (e: Exception) {
XLog.w(context.getString(R.string.gallery_adder_could_not_add_manga, url), e)
logger.w(context.getString(R.string.gallery_adder_could_not_add_manga, url), e)
if (e is EHentai.GalleryNotFoundException) {
return GalleryAddEvent.Fail.NotFound(url, context)

View File

@ -30,6 +30,7 @@ import kotlinx.serialization.json.Json
import uy.kohesive.injekt.injectLazy
import java.lang.RuntimeException
@Suppress("unused")
object DebugFunctions {
val app: Application by injectLazy()
val db: DatabaseHelper by injectLazy()
@ -239,7 +240,7 @@ object DebugFunctions {
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
} catch (t: RuntimeException) {
// Load failed
XLog.e("Failed to load saved search!", t)
XLog.tag("DebugFunctions").e("Failed to load saved search!", t)
t.printStackTrace()
null
}
@ -251,7 +252,7 @@ object DebugFunctions {
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
} catch (t: RuntimeException) {
// Load failed
XLog.e("Failed to load saved search!", t)
XLog.tag("DebugFunctions").e("Failed to load saved search!", t)
t.printStackTrace()
null
}
@ -278,7 +279,7 @@ object DebugFunctions {
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
} catch (t: RuntimeException) {
// Load failed
XLog.e("Failed to load saved search!", t)
XLog.tag("DebugFunctions").e("Failed to load saved search!", t)
t.printStackTrace()
null
}
@ -290,7 +291,7 @@ object DebugFunctions {
Json.decodeFromString<JsonSavedSearch>(it.substringAfter(':'))
} catch (t: RuntimeException) {
// Load failed
XLog.e("Failed to load saved search!", t)
XLog.tag("DebugFunctions").e("Failed to load saved search!", t)
t.printStackTrace()
null
}

View File

@ -93,7 +93,7 @@ class MemAutoFlushingLookupTable<T>(
}
}
} catch (e: FileNotFoundException) {
XLog.d("Lookup table not found!", e)
XLog.tag("MemAutoFlushingLookupTable").enableStackTrace(2).d("Lookup table not found!", e)
// Ignored
}

View File

@ -11,9 +11,9 @@ fun OkHttpClient.Builder.maybeInjectEHLogger(): OkHttpClient.Builder {
val logger: HttpLoggingInterceptor.Logger = HttpLoggingInterceptor.Logger { message ->
try {
Json.decodeFromString<Any>(message)
XLog.tag("||EH-NETWORK-JSON").nst().json(message)
XLog.tag("||EH-NETWORK-JSON").json(message)
} catch (ex: Exception) {
XLog.tag("||EH-NETWORK").nb().nst().d(message)
XLog.tag("||EH-NETWORK").disableBorder().d(message)
}
}
return addInterceptor(HttpLoggingInterceptor(logger).apply { level = HttpLoggingInterceptor.Level.BODY })

View File

@ -1,6 +1,5 @@
package exh.log
import com.elvishew.xlog.flattener.Flattener2
import com.elvishew.xlog.internal.DefaultsFactory
import com.elvishew.xlog.printer.Printer
import com.elvishew.xlog.printer.file.backup.BackupStrategy
@ -12,6 +11,7 @@ import java.io.FileWriter
import java.io.IOException
import java.util.concurrent.BlockingQueue
import java.util.concurrent.LinkedBlockingQueue
import com.elvishew.xlog.flattener.Flattener2 as Flattener
/**
* Log [Printer] using file system. When print a log, it will print it to the specified file.
@ -31,7 +31,7 @@ class EnhancedFilePrinter internal constructor(
private val fileNameGenerator: FileNameGenerator,
private val backupStrategy: BackupStrategy,
private val cleanStrategy: CleanStrategy,
private val flattener: Flattener2
private val flattener: Flattener
) : Printer {
/**
* Log writer.
@ -134,7 +134,7 @@ class EnhancedFilePrinter internal constructor(
/**
* The flattener when print a log.
*/
private var flattener: Flattener2? = null
private var flattener: Flattener? = null
/**
* Set the file name generator for log file.
@ -174,9 +174,8 @@ class EnhancedFilePrinter internal constructor(
*
* @param flattener the flattener when print a log
* @return the builder
* @since 1.6.0
*/
fun flattener(flattener: Flattener2): Builder {
fun flattener(flattener: Flattener): Builder {
this.flattener = flattener
return this
}
@ -187,11 +186,13 @@ class EnhancedFilePrinter internal constructor(
* @return the built configured [EnhancedFilePrinter] object
*/
fun build(): EnhancedFilePrinter {
val fileNameGenerator = fileNameGenerator ?: DefaultsFactory.createFileNameGenerator()
val backupStrategy = backupStrategy ?: DefaultsFactory.createBackupStrategy()
val cleanStrategy = cleanStrategy ?: DefaultsFactory.createCleanStrategy()
val flattener = flattener ?: DefaultsFactory.createFlattener2()
return EnhancedFilePrinter(folderPath, fileNameGenerator, backupStrategy, cleanStrategy, flattener)
return EnhancedFilePrinter(
folderPath,
fileNameGenerator ?: DefaultsFactory.createFileNameGenerator(),
backupStrategy ?: DefaultsFactory.createBackupStrategy(),
cleanStrategy ?: DefaultsFactory.createCleanStrategy(),
flattener ?: DefaultsFactory.createFlattener2()
)
}
}
@ -244,8 +245,8 @@ class EnhancedFilePrinter internal constructor(
}
override fun run() {
var log: LogItem
try {
var log: LogItem
while (logs.take().also { log = it } != null) {
doPrintln(log.timeMillis, log.level, log.tag, log.msg)
}
@ -341,7 +342,7 @@ class EnhancedFilePrinter internal constructor(
*/
fun appendLog(flattenedLog: String) {
val bufferedWriter = bufferedWriter
require(bufferedWriter != null)
requireNotNull(bufferedWriter)
try {
bufferedWriter.write(flattenedLog)
bufferedWriter.newLine()

View File

@ -129,7 +129,7 @@ class ApiMangaParser(private val langs: List<String>) {
if (tags.isNotEmpty()) tags.clear()
tags += genres.map { RaisedTag(null, it, MangaDexSearchMetadata.TAG_TYPE_DEFAULT) }
} catch (e: Exception) {
XLog.e(e)
XLog.tag("ApiMangaParser").enableStackTrace(2).e(e)
throw e
}
}
@ -239,7 +239,7 @@ class ApiMangaParser(private val langs: List<String>) {
val jsonObject = Json.decodeFromString<JsonObject>(body)
return jsonObject["manga_id"]?.jsonPrimitive?.intOrNull ?: throw Exception("No manga associated with chapter")
} catch (e: Exception) {
XLog.e(e)
XLog.tag("ApiMangaParser").enableStackTrace(2).e(e)
throw e
}
}

View File

@ -51,7 +51,7 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
response.body?.string().orEmpty()
)
} catch (e: Exception) {
XLog.e("error parsing follows", e)
XLog.tag("FollowsHandler").enableStackTrace(2).e("error parsing follows", e)
FollowsPageResult()
}
@ -81,7 +81,7 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
response.body?.string().orEmpty()
)
} catch (e: Exception) {
XLog.e("error parsing follows", e)
XLog.tag("FollowsHandler").enableStackTrace(2).e("error parsing follows", e)
FollowsPageResult()
}
val track = Track.create(TrackManager.MDLIST)
@ -158,7 +158,7 @@ class FollowsHandler(val client: OkHttpClient, val headers: Headers, val prefere
val mangaID = MdUtil.getMangaId(track.tracking_url)
val formBody = FormBody.Builder()
.add("chapter", track.last_chapter_read.toString())
XLog.d("chapter to update %s", track.last_chapter_read.toString())
XLog.tag("FollowsHandler").d("chapter to update %s", track.last_chapter_read.toString())
val response = client.newCall(
POST(
"${MdUtil.baseUrl}/ajax/actions.ajax.php?function=edit_progress&id=$mangaID",

View File

@ -27,7 +27,7 @@ class MangaHandler(val client: OkHttpClient, val headers: Headers, val langs: Li
val jsonData = withContext(Dispatchers.IO) { response.body!!.string() }
if (response.code != 200) {
XLog.e("error from MangaDex with response code ${response.code} \n body: \n$jsonData")
XLog.tag("MangaHandler").enableStackTrace(2).e("error from MangaDex with response code ${response.code} \n body: \n$jsonData")
throw Exception("Error from MangaDex Response code ${response.code} ")
}

View File

@ -118,7 +118,7 @@ class SimilarUpdateService(
// Unsubscribe from any previous subscription if needed.
job?.cancel()
val handler = CoroutineExceptionHandler { _, exception ->
XLog.e(exception)
XLog.tag("SimilarUpdateService").enableStackTrace(2).e(exception)
stopSelf(startId)
showResultNotification(true)
cancelProgressNotification()

View File

@ -37,7 +37,7 @@ class ConfiguringDialogController : DialogController() {
.show()
}
}
XLog.e("Configuration error!", e)
XLog.tag("ConfiguringDialogController").enableStackTrace(2).e("Configuration error!", e)
}
launchUI {
finish()

View File

@ -81,7 +81,7 @@ class EHConfigurator(val context: Context) {
}
}
XLog.nst().d("Hath perks: $hathPerks")
XLog.tag("EHConfigurator").d("Hath perks: $hathPerks")
configure(ehSource, hathPerks)
configure(exhSource, hathPerks)

View File

@ -59,7 +59,7 @@ class BatchAddPresenter : BasePresenter<BatchAddController>() {
currentlyAddingRelay.call(STATE_INPUT_TO_PROGRESS)
val handler = CoroutineExceptionHandler { _, throwable ->
XLog.e(throwable)
XLog.tag("BatchAddPresenter").enableStackTrace(2).e(throwable)
}
scope.launch(Dispatchers.IO + handler) {

View File

@ -187,7 +187,7 @@ class BrowserActionActivity : AppCompatActivity() {
suspend fun captchaSolveFail() {
currentLoopId = null
validateCurrentLoopId = null
XLog.e(IllegalStateException("Captcha solve failure!"))
XLog.tag("BrowserActionActivity").enableStackTrace(2).e(IllegalStateException("Captcha solve failure!"))
withContext(Dispatchers.Main) {
binding.webview.evaluateJavascript(SOLVE_UI_SCRIPT_HIDE, null)
MaterialDialog(this@BrowserActionActivity)
@ -231,7 +231,7 @@ class BrowserActionActivity : AppCompatActivity() {
val ih = splitResult[3]
val x = binding.webview.x + origX / iw * binding.webview.width
val y = binding.webview.y + origY / ih * binding.webview.height
XLog.nst().d("Found audio button coords: %f %f", x, y)
XLog.tag("BrowserActionActivity").d("Found audio button coords: %f %f", x, y)
simulateClick(x + 50, y + 50)
binding.webview.post {
doStageDownloadAudio(loopId)
@ -247,12 +247,12 @@ class BrowserActionActivity : AppCompatActivity() {
}
STAGE_DOWNLOAD_AUDIO -> {
if (result != null) {
XLog.nst().d("Got audio URL: $result")
XLog.tag("BrowserActionActivity").d("Got audio URL: $result")
performRecognize(result)
.observeOn(Schedulers.io())
.subscribe(
{
XLog.nst().d("Got audio transcript: $it")
XLog.tag("BrowserActionActivity").d("Got audio transcript: $it")
binding.webview.post {
typeResult(
loopId,
@ -465,7 +465,7 @@ class BrowserActionActivity : AppCompatActivity() {
if (loopId != validateCurrentLoopId) return
if (result) {
XLog.nst().d("Captcha solved!")
XLog.tag("BrowserActionActivity").d("Captcha solved!")
binding.webview.post {
binding.webview.evaluateJavascript(SOLVE_UI_SCRIPT_HIDE, null)
}

View File

@ -91,7 +91,7 @@ class LoginController : NucleusController<EhActivityLoginBinding, LoginPresenter
binding.webview.webViewClient = object : WebViewClient() {
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
XLog.nst().d(url)
XLog.tag("LoginController").d(url)
val parsedUrl = Uri.parse(url)
if (parsedUrl.host.equals("forums.e-hentai.org", ignoreCase = true)) {
// Hide distracting content

View File

@ -27,7 +27,7 @@ class MetadataViewPresenter(
override fun onCreate(savedState: Bundle?) {
super.onCreate(savedState)
getMangaMetaObservable().subscribeLatestCache({ view, flatMetadata -> if (flatMetadata != null) view.onNextMetaInfo(flatMetadata) else XLog.nst().d("Invalid metadata") })
getMangaMetaObservable().subscribeLatestCache({ view, flatMetadata -> if (flatMetadata != null) view.onNextMetaInfo(flatMetadata) else XLog.tag("MetadataViewPresenter").disableStackTrace().d("Invalid metadata") })
getMangaObservable()
.observeOn(AndroidSchedulers.mainThread())

View File

@ -21,7 +21,7 @@ fun Response.interceptAsHtml(block: (Document) -> Unit): Response {
block(parsed)
} catch (t: Throwable) {
// Ignore all errors
XLog.w("Interception error!", t)
XLog.tag("Response.interceptAsHtml").enableStackTrace(2).w("Interception error!", t)
} finally {
close()
}