Skip to content

Commit 3a77e59

Browse files
committed
migrate logs to log4j
1 parent e6598b7 commit 3a77e59

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/kotlin/ModbusPacketDecoder.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class ModbusPacketDecoder : ByteToMessageDecoder() {
2424
val st = String.format("%02X", `in`.getByte(i))
2525
print(st)
2626
}
27-
println()
2827

2928
if (`in`!!.readableBytes() < 6) {
3029
logger.debug("less than 6 bytes received, ignoring...")

src/main/kotlin/ModbusServerEventListenerReplyRandomNumbers.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1+
import org.slf4j.LoggerFactory
12
import kotlin.random.Random
23

34
class ModbusServerEventListenerReplyRandomNumbers : IModbusServerEventListener {
45

6+
companion object {
7+
val logger = LoggerFactory.getLogger("ModbusServerEventListenerReplyRandomNumbers")
8+
}
9+
510
private fun generateRandomLogicList(numberOfRegisters: Int): List<Boolean> {
611
val mutableList = mutableListOf<Boolean>()
712
for(i in 0..numberOfRegisters)
813
mutableList.add(Random.nextBoolean())
9-
println(mutableList.toString())
14+
logger.debug(mutableList.toString())
1015
return mutableList
1116
}
1217

1318
private fun generateRandomNumericList(numberOfRegisters: Int): List<Short> {
1419
val mutableList = mutableListOf<Short>()
1520
for(i in 0..numberOfRegisters)
1621
mutableList.add(Random.nextInt(Short.MAX_VALUE.toInt()).toShort())
17-
println(mutableList.toString())
22+
logger.debug(mutableList.toString())
1823
return mutableList
1924
}
2025

0 commit comments

Comments
 (0)