KSLog/src/androidMain/kotlin/KSLoggerDefaultPlatformLoggerLambda.kt

16 lines
633 B
Kotlin
Raw Normal View History

2022-06-07 14:02:59 +00:00
package dev.inmo.kslog.common
2022-06-07 13:26:11 +00:00
import android.util.Log
2023-11-18 11:55:19 +00:00
actual var KSLoggerDefaultPlatformLoggerLambda: (level: LogLevel, tag: String, message: Any, throwable: Throwable?) -> Unit = { l, t, m, e ->
val messageString = m.toString()
2022-06-08 12:23:11 +00:00
when(l) {
2023-11-18 10:18:08 +00:00
LogLevel.TRACE -> Log.d(t, messageString, e)
LogLevel.DEBUG -> Log.d(t, messageString, e)
LogLevel.VERBOSE -> Log.v(t, messageString, e)
LogLevel.INFO -> Log.i(t, messageString, e)
LogLevel.WARNING -> Log.w(t, messageString, e)
LogLevel.ERROR -> Log.e(t, messageString, e)
LogLevel.ASSERT -> Log.wtf(t, messageString, e)
2022-06-08 12:23:11 +00:00
}
2023-11-18 11:55:19 +00:00
}