From 0193f6488bd4aba150f73582233f34a20035156d Mon Sep 17 00:00:00 2001 From: Denis Plotnikov Date: Mon, 9 Oct 2023 11:11:45 +0400 Subject: [PATCH] additional logging --- .../kotlin/com/exactpro/th2/conn/dirty/fix/FixByteBufUtil.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/com/exactpro/th2/conn/dirty/fix/FixByteBufUtil.kt b/src/main/kotlin/com/exactpro/th2/conn/dirty/fix/FixByteBufUtil.kt index 7b6548c..fc80dc7 100644 --- a/src/main/kotlin/com/exactpro/th2/conn/dirty/fix/FixByteBufUtil.kt +++ b/src/main/kotlin/com/exactpro/th2/conn/dirty/fix/FixByteBufUtil.kt @@ -28,6 +28,7 @@ import com.exactpro.th2.netty.bytebuf.util.subsequence import io.netty.buffer.ByteBuf import java.nio.charset.Charset import kotlin.text.Charsets.UTF_8 +import mu.KotlinLogging const val SOH_CHAR = '\u0001' const val SOH_BYTE = SOH_CHAR.code.toByte() @@ -43,6 +44,7 @@ fun ByteBuf.firstField(charset: Charset = UTF_8): FixField? = FixField.atOffset( @JvmOverloads fun ByteBuf.lastField(charset: Charset = UTF_8): FixField? = FixField.atOffset(this, writerIndex() - 1, charset) +val K_LOGGER = KotlinLogging.logger { } @JvmOverloads inline fun ByteBuf.forEachField( charset: Charset = UTF_8, @@ -51,9 +53,12 @@ inline fun ByteBuf.forEachField( ) { var field = start + field?.bytes?.let { K_LOGGER.info { "Processing field: ${String(it)}" } } + while (field != null) { action(field) field = field.next() + field?.bytes?.let { K_LOGGER.info { "Processing field: ${String(it)}" } } } }