isolate logging of KSLog'gers to avoid problems with parallel logs perform

This commit is contained in:
InsanusMokrassar 2022-07-31 19:13:02 +06:00
parent 3ff5d989b7
commit 34ea0bd91a

View File

@ -4,6 +4,12 @@ import dev.inmo.kslog.common.CallbackKSLog
import dev.inmo.kslog.common.KSLog import dev.inmo.kslog.common.KSLog
infix operator fun KSLog.plus(other: KSLog) = CallbackKSLog { l, t, m, e -> infix operator fun KSLog.plus(other: KSLog) = CallbackKSLog { l, t, m, e ->
this@plus.performLog(l, t, m, e) val resultOfFirst = runCatching {
other.performLog(l, t, m, e) this@plus.performLog(l, t, m, e)
}
val resultOfSecond = runCatching {
other.performLog(l, t, m, e)
}
resultOfFirst.onFailure { throw it }
resultOfSecond.onFailure { throw it }
} }