Merge pull request #2005 from davotoula/Introduce-log-level-filtering
Introduce log level filtering
This commit is contained in:
+16
-17
@@ -22,42 +22,41 @@ package com.vitorpamplona.quartz.utils
|
||||
|
||||
import platform.Foundation.NSLog
|
||||
|
||||
actual object Log {
|
||||
actual fun w(
|
||||
actual object PlatformLog {
|
||||
private fun log(
|
||||
level: String,
|
||||
tag: String,
|
||||
message: String,
|
||||
throwable: Throwable?,
|
||||
) {
|
||||
if (throwable != null) {
|
||||
NSLog("WARN: [$tag] $message. Throwable: $throwable CAUSE ${throwable.cause}")
|
||||
NSLog("$level: [$tag] $message. Throwable: $throwable CAUSE ${throwable.cause}")
|
||||
} else {
|
||||
NSLog("WARN: [$tag] $message")
|
||||
NSLog("$level: [$tag] $message")
|
||||
}
|
||||
}
|
||||
|
||||
actual fun w(
|
||||
tag: String,
|
||||
message: String,
|
||||
throwable: Throwable?,
|
||||
) = log("WARN", tag, message, throwable)
|
||||
|
||||
actual fun e(
|
||||
tag: String,
|
||||
message: String,
|
||||
throwable: Throwable?,
|
||||
) {
|
||||
if (throwable != null) {
|
||||
NSLog("ERROR: [$tag] $message. Throwable: $throwable CAUSE ${throwable.cause}")
|
||||
} else {
|
||||
NSLog("ERROR: [$tag] $message")
|
||||
}
|
||||
}
|
||||
) = log("ERROR", tag, message, throwable)
|
||||
|
||||
actual fun d(
|
||||
tag: String,
|
||||
message: String,
|
||||
) {
|
||||
NSLog("DEBUG: [$tag] $message")
|
||||
}
|
||||
throwable: Throwable?,
|
||||
) = log("DEBUG", tag, message, throwable)
|
||||
|
||||
actual fun i(
|
||||
tag: String,
|
||||
message: String,
|
||||
) {
|
||||
NSLog("INFO: [$tag] $message")
|
||||
}
|
||||
throwable: Throwable?,
|
||||
) = log("INFO", tag, message, throwable)
|
||||
}
|
||||
Reference in New Issue
Block a user