Skip to content

Commit

Permalink
additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Plotnikov committed Oct 9, 2023
1 parent 1eb9baf commit 0193f64
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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,
Expand All @@ -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)}" } }
}
}

Expand Down

0 comments on commit 0193f64

Please sign in to comment.