From 526d3e9c90df7021379a54d122f7cbcd3e2fe34b Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 18 Nov 2020 08:25:24 +0800 Subject: [PATCH] =?UTF-8?q?js=E6=B7=BB=E5=8A=A0java.log(msg:=20String)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/JsExtensions.kt | 4 ++++ app/src/main/java/io/legado/app/model/Debug.kt | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 642905691..c692be75e 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -5,6 +5,7 @@ import androidx.annotation.Keep import io.legado.app.constant.AppConst.dateFormat import io.legado.app.help.http.CookieStore import io.legado.app.help.http.SSLHelper +import io.legado.app.model.Debug import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.* import org.jsoup.Connection @@ -206,4 +207,7 @@ interface JsExtensions { return Base64.decode(str, flags) } + fun log(msg: String) { + Debug.log(msg) + } } diff --git a/app/src/main/java/io/legado/app/model/Debug.kt b/app/src/main/java/io/legado/app/model/Debug.kt index 4e419bef4..cfd64d6ee 100644 --- a/app/src/main/java/io/legado/app/model/Debug.kt +++ b/app/src/main/java/io/legado/app/model/Debug.kt @@ -41,6 +41,11 @@ object Debug { callback?.printLog(state, printMsg) } + @Synchronized + fun log(msg: String?) { + log(debugSource, msg, true) + } + fun cancelDebug(destroy: Boolean = false) { tasks.clear()