From 96281ab581c0ff0d85ebc375b3bace675c7c5696 Mon Sep 17 00:00:00 2001 From: Kevin Galligan Date: Wed, 11 Oct 2023 13:01:52 -0400 Subject: [PATCH] Restore global api functions (#372) --- kermit/api/android/kermit.api | 12 ++++++++ kermit/api/jvm/kermit.api | 12 ++++++++ .../kotlin/co/touchlab/kermit/Logger.kt | 30 +++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/kermit/api/android/kermit.api b/kermit/api/android/kermit.api index c7a73ecf..d5b90d31 100644 --- a/kermit/api/android/kermit.api +++ b/kermit/api/android/kermit.api @@ -55,11 +55,23 @@ public class co/touchlab/kermit/Logger : co/touchlab/kermit/BaseLogger { } public final class co/touchlab/kermit/Logger$Companion : co/touchlab/kermit/Logger { + public final fun a (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun a$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V public final fun addLogWriter ([Lco/touchlab/kermit/LogWriter;)V + public final fun d (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun d$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V + public final fun e (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun e$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V public fun getTag ()Ljava/lang/String; + public final fun i (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun i$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V public final fun setLogWriters (Ljava/util/List;)V public final fun setLogWriters ([Lco/touchlab/kermit/LogWriter;)V public final fun setMinSeverity (Lco/touchlab/kermit/Severity;)V public final fun setTag (Ljava/lang/String;)V + public final fun v (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun v$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V + public final fun w (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun w$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V } diff --git a/kermit/api/jvm/kermit.api b/kermit/api/jvm/kermit.api index c7a73ecf..d5b90d31 100644 --- a/kermit/api/jvm/kermit.api +++ b/kermit/api/jvm/kermit.api @@ -55,11 +55,23 @@ public class co/touchlab/kermit/Logger : co/touchlab/kermit/BaseLogger { } public final class co/touchlab/kermit/Logger$Companion : co/touchlab/kermit/Logger { + public final fun a (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun a$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V public final fun addLogWriter ([Lco/touchlab/kermit/LogWriter;)V + public final fun d (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun d$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V + public final fun e (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun e$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V public fun getTag ()Ljava/lang/String; + public final fun i (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun i$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V public final fun setLogWriters (Ljava/util/List;)V public final fun setLogWriters ([Lco/touchlab/kermit/LogWriter;)V public final fun setMinSeverity (Lco/touchlab/kermit/Severity;)V public final fun setTag (Ljava/lang/String;)V + public final fun v (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun v$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V + public final fun w (Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;)V + public static synthetic fun w$default (Lco/touchlab/kermit/Logger$Companion;Ljava/lang/String;Ljava/lang/Throwable;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V } diff --git a/kermit/src/commonMain/kotlin/co/touchlab/kermit/Logger.kt b/kermit/src/commonMain/kotlin/co/touchlab/kermit/Logger.kt index e88bdde0..70e806b5 100644 --- a/kermit/src/commonMain/kotlin/co/touchlab/kermit/Logger.kt +++ b/kermit/src/commonMain/kotlin/co/touchlab/kermit/Logger.kt @@ -112,6 +112,36 @@ open class Logger( fun setTag(tag: String) { defaultTag = tag } + + fun v(tag: String, throwable: Throwable? = null, message: () -> String) { + if (config.minSeverity <= Severity.Verbose) + log(Severity.Verbose, tag, throwable, message()) + } + + fun d(tag: String, throwable: Throwable? = null, message: () -> String) { + if (config.minSeverity <= Severity.Debug) + log(Severity.Debug, tag, throwable, message()) + } + + fun i(tag: String, throwable: Throwable? = null, message: () -> String) { + if (config.minSeverity <= Severity.Info) + log(Severity.Info, tag, throwable, message()) + } + + fun w(tag: String, throwable: Throwable? = null, message: () -> String) { + if (config.minSeverity <= Severity.Warn) + log(Severity.Warn, tag, throwable, message()) + } + + fun e(tag: String, throwable: Throwable? = null, message: () -> String) { + if (config.minSeverity <= Severity.Error) + log(Severity.Error, tag, throwable, message()) + } + + fun a(tag: String, throwable: Throwable? = null, message: () -> String) { + if (config.minSeverity <= Severity.Assert) + log(Severity.Assert, tag, throwable, message()) + } } }