KSLog/src/commonMain/kotlin/KSLogTypealiases.kt

8 lines
544 B
Kotlin
Raw Normal View History

2022-06-08 12:23:11 +00:00
package dev.inmo.kslog.common
typealias MessageFormatter = (l: LogLevel, t: String?, m: Any, Throwable?) -> String
2022-07-31 13:19:17 +00:00
inline fun MessageFormatter(noinline formatter: MessageFormatter) = formatter
2022-06-09 10:29:56 +00:00
typealias MessageFilter = (l: LogLevel, t: String?, Throwable?) -> Boolean
val defaultMessageFormatter: MessageFormatter = { l, t, m, _ -> "[$l] ${t ?.let { "$it " } ?: ""}- $m" }
val defaultMessageFormatterWithErrorPrint: MessageFormatter = { l, t, m, e -> "[$l] ${t ?.let { "$it " } ?: ""}- $m${e ?.let { ": ${it.stackTraceToString()}" } ?: ""}" }