From 3f4ef1ab3e075e690550f2636dbb625a30cb26b5 Mon Sep 17 00:00:00 2001 From: ego Date: Wed, 18 Aug 2021 10:40:19 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opensource/svgaplayer/utils/log/DefaultLogCat.kt | 10 +--------- .../com/opensource/svgaplayer/utils/log/ILogger.kt | 4 +--- .../com/opensource/svgaplayer/utils/log/LogUtils.kt | 10 +++++----- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/library/src/main/java/com/opensource/svgaplayer/utils/log/DefaultLogCat.kt b/library/src/main/java/com/opensource/svgaplayer/utils/log/DefaultLogCat.kt index fee1a24e..33200b0e 100644 --- a/library/src/main/java/com/opensource/svgaplayer/utils/log/DefaultLogCat.kt +++ b/library/src/main/java/com/opensource/svgaplayer/utils/log/DefaultLogCat.kt @@ -22,15 +22,7 @@ class DefaultLogCat : ILogger { Log.w(tag, msg) } - override fun error(tag: String, msg: String) { - Log.e(tag, msg) - } - - override fun error(tag: String, error: Throwable) { - Log.e(tag, "", error) - } - - override fun error(tag: String, msg: String, error: Throwable) { + override fun error(tag: String, msg: String?, error: Throwable?) { Log.e(tag, msg, error) } } \ No newline at end of file diff --git a/library/src/main/java/com/opensource/svgaplayer/utils/log/ILogger.kt b/library/src/main/java/com/opensource/svgaplayer/utils/log/ILogger.kt index bb190330..ad935104 100644 --- a/library/src/main/java/com/opensource/svgaplayer/utils/log/ILogger.kt +++ b/library/src/main/java/com/opensource/svgaplayer/utils/log/ILogger.kt @@ -8,7 +8,5 @@ interface ILogger { fun info(tag: String, msg: String) fun debug(tag: String, msg: String) fun warn(tag: String, msg: String) - fun error(tag: String, msg: String) - fun error(tag: String, error: Throwable) - fun error(tag: String, msg: String, error: Throwable) + fun error(tag: String, msg: String?, error: Throwable?) } \ No newline at end of file diff --git a/library/src/main/java/com/opensource/svgaplayer/utils/log/LogUtils.kt b/library/src/main/java/com/opensource/svgaplayer/utils/log/LogUtils.kt index 4f9cfdb1..60c67f9c 100644 --- a/library/src/main/java/com/opensource/svgaplayer/utils/log/LogUtils.kt +++ b/library/src/main/java/com/opensource/svgaplayer/utils/log/LogUtils.kt @@ -38,20 +38,20 @@ internal object LogUtils { if (!SVGALogger.isLogEnabled()) { return } - SVGALogger.getSVGALogger()?.error(tag, msg) + SVGALogger.getSVGALogger()?.error(tag, msg, null) } - fun error(tag: String = TAG, msg: String, error: Throwable) { + fun error(tag: String, error: Throwable) { if (!SVGALogger.isLogEnabled()) { return } - SVGALogger.getSVGALogger()?.error(tag, msg, error) + SVGALogger.getSVGALogger()?.error(tag, error.message, error) } - fun error(tag: String, error: Throwable) { + fun error(tag: String = TAG, msg: String, error: Throwable) { if (!SVGALogger.isLogEnabled()) { return } - SVGALogger.getSVGALogger()?.error(tag, error) + SVGALogger.getSVGALogger()?.error(tag, msg, error) } } \ No newline at end of file