Deprecate throwable logging function, produces bad log

This commit is contained in:
Jobobby04 2021-03-08 19:50:41 -05:00
parent 984956ce95
commit ccdae6bb9a
6 changed files with 12 additions and 9 deletions

View File

@ -17,10 +17,15 @@ fun Any.xLog(logLevel: LogLevel, log: String) = xLog().log(logLevel.int, log)
fun Any.xLogJson(log: String) = xLog().json(log) fun Any.xLogJson(log: String) = xLog().json(log)
fun Any.xLogXML(log: String) = xLog().xml(log) fun Any.xLogXML(log: String) = xLog().xml(log)
@Deprecated("Use proper throwable function", ReplaceWith("""xLogE("", log)"""))
fun Any.xLogE(log: Throwable) = xLogStack().e(log) fun Any.xLogE(log: Throwable) = xLogStack().e(log)
@Deprecated("Use proper throwable function", ReplaceWith("""xLogW("", log)"""))
fun Any.xLogW(log: Throwable) = xLogStack().w(log) fun Any.xLogW(log: Throwable) = xLogStack().w(log)
@Deprecated("Use proper throwable function", ReplaceWith("""xLogD("", log)"""))
fun Any.xLogD(log: Throwable) = xLogStack().d(log) fun Any.xLogD(log: Throwable) = xLogStack().d(log)
@Deprecated("Use proper throwable function", ReplaceWith("""xLogI("", log)"""))
fun Any.xLogI(log: Throwable) = xLogStack().i(log) fun Any.xLogI(log: Throwable) = xLogStack().i(log)
@Deprecated("Use proper throwable function", ReplaceWith("""xLog(logLevel, "", log)"""))
fun Any.xLog(logLevel: LogLevel, log: Throwable) = xLogStack().log(logLevel.int, log) fun Any.xLog(logLevel: LogLevel, log: Throwable) = xLogStack().log(logLevel.int, log)
fun Any.xLogE(log: String, e: Throwable) = xLogStack().e(log, e) fun Any.xLogE(log: String, e: Throwable) = xLogStack().e(log, e)

View File

@ -150,7 +150,7 @@ class ApiMangaParser(private val lang: String) {
if (tags.isNotEmpty()) tags.clear() if (tags.isNotEmpty()) tags.clear()
tags += genres.map { RaisedTag(null, it, MangaDexSearchMetadata.TAG_TYPE_DEFAULT) } tags += genres.map { RaisedTag(null, it, MangaDexSearchMetadata.TAG_TYPE_DEFAULT) }
} catch (e: Exception) { } catch (e: Exception) {
xLogE(e) xLogE("Parse into metadata error", e)
throw e throw e
} }
} }
@ -250,13 +250,9 @@ class ApiMangaParser(private val lang: String) {
fun chapterParseForMangaId(response: Response): Int { fun chapterParseForMangaId(response: Response): Int {
try { try {
if (response.code != 200) throw Exception("HTTP error ${response.code}")
checkNotNull(response.body) {
"Null Response"
}
return response.parseAs<ApiChapterSerializer>().data.mangaId return response.parseAs<ApiChapterSerializer>().data.mangaId
} catch (e: Exception) { } catch (e: Exception) {
xLogE(e) xLogE("Parse for manga id error", e)
throw e throw e
} }
} }

View File

@ -135,7 +135,7 @@ class SimilarUpdateService(
// Unsubscribe from any previous subscription if needed. // Unsubscribe from any previous subscription if needed.
job?.cancel() job?.cancel()
val handler = CoroutineExceptionHandler { _, exception -> val handler = CoroutineExceptionHandler { _, exception ->
xLogE(exception) xLogE("Similar manga update error", exception)
stopSelf(startId) stopSelf(startId)
showResultNotification(true) showResultNotification(true)
cancelProgressNotification() cancelProgressNotification()

View File

@ -56,7 +56,7 @@ class BatchAddPresenter : BasePresenter<BatchAddController>() {
currentlyAddingRelay.call(STATE_INPUT_TO_PROGRESS) currentlyAddingRelay.call(STATE_INPUT_TO_PROGRESS)
val handler = CoroutineExceptionHandler { _, throwable -> val handler = CoroutineExceptionHandler { _, throwable ->
xLogE(throwable) xLogE("Batch add error", throwable)
} }
presenterScope.launch(Dispatchers.IO + handler) { presenterScope.launch(Dispatchers.IO + handler) {

View File

@ -187,7 +187,7 @@ class BrowserActionActivity : AppCompatActivity() {
suspend fun captchaSolveFail() { suspend fun captchaSolveFail() {
currentLoopId = null currentLoopId = null
validateCurrentLoopId = null validateCurrentLoopId = null
xLogE(IllegalStateException("Captcha solve failure!")) xLogE("Captcha solve Error", IllegalStateException("Captcha solve failure!"))
withUIContext { withUIContext {
binding.webview.evaluateJavascript(SOLVE_UI_SCRIPT_HIDE, null) binding.webview.evaluateJavascript(SOLVE_UI_SCRIPT_HIDE, null)
MaterialDialog(this@BrowserActionActivity) MaterialDialog(this@BrowserActionActivity)

View File

@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.source.online.all.MangaDex
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.util.lang.launchUI import eu.kanade.tachiyomi.util.lang.launchUI
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import exh.log.xLogW
import exh.source.getMainSource import exh.source.getMainSource
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -109,6 +110,7 @@ class MangadexLoginDialog(bundle: Bundle? = null) : DialogController(bundle) {
} }
} catch (error: Exception) { } catch (error: Exception) {
errorResult() errorResult()
xLogW("Login to Mangadex error", error)
error.message?.let { launchUI { binding.root.context.toast(it) } } error.message?.let { launchUI { binding.root.context.toast(it) } }
} }
} }