From 34ea0bd91ad9d74dd7adc8e281ed17b701387f79 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 31 Jul 2022 19:13:02 +0600 Subject: [PATCH] isolate logging of KSLog'gers to avoid problems with parallel logs perform --- src/commonMain/kotlin/utils/Combination.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commonMain/kotlin/utils/Combination.kt b/src/commonMain/kotlin/utils/Combination.kt index 9e43fd1..cee2897 100644 --- a/src/commonMain/kotlin/utils/Combination.kt +++ b/src/commonMain/kotlin/utils/Combination.kt @@ -4,6 +4,12 @@ import dev.inmo.kslog.common.CallbackKSLog import dev.inmo.kslog.common.KSLog infix operator fun KSLog.plus(other: KSLog) = CallbackKSLog { l, t, m, e -> - this@plus.performLog(l, t, m, e) - other.performLog(l, t, m, e) + val resultOfFirst = runCatching { + this@plus.performLog(l, t, m, e) + } + val resultOfSecond = runCatching { + other.performLog(l, t, m, e) + } + resultOfFirst.onFailure { throw it } + resultOfSecond.onFailure { throw it } }