commit 9b10573eb1a8452cf9bce1ba236e95f23e20ed67
parent fbd683251a7e2d92312996fbc75ea5e6651ad5ed
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Tue, 30 Apr 2024 00:18:03 +0200

fix(bridge): chunked logs

Diffstat:
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/bridge/BridgeClient.kt | 6+++++-
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/ComposerHooks.kt | 2+-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/bridge/BridgeClient.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/bridge/BridgeClient.kt @@ -118,7 +118,11 @@ class BridgeClient( } fun broadcastLog(tag: String, level: String, message: String) { - safeServiceCall { service.broadcastLog(tag, level, message) } + message.chunked(1024 * 256).forEach { + safeServiceCall { + service.broadcastLog(tag, level, it) + } + } } //TODO: use interfaces instead of direct file access diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/ComposerHooks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/experiments/ComposerHooks.kt @@ -167,7 +167,7 @@ class ComposerHooks: Feature("ComposerHooks", loadParams = FeatureLoadParams.ACT "log" -> { if (argc < 3) return false val logLevel = composerMarshaller.getUntyped(1) as? String ?: return false - val message = (composerMarshaller.getUntyped(2) as? String)?.takeIf { it.length < 1024 * 512 } ?: return false + val message = composerMarshaller.getUntyped(2) as? String ?: return false val tag = "ComposerLogs"