Skip to content

Commit 8bafb95

Browse files
Reduce log verbosity
1 parent b58eb3a commit 8bafb95

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpPacketCodec.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public void encode(ChannelHandlerContext ctx, Packet packet, ByteBuf buf) {
3535
return;
3636
}
3737

38-
if (log.isDebugEnabled()) {
39-
log.debug("Encoding packet: {}", packet.getClass().getSimpleName());
38+
if (log.isTraceEnabled()) {
39+
log.trace("Encoding packet: {}", packet.getClass().getSimpleName());
4040
}
4141

4242
int initial = buf.writerIndex();
@@ -51,7 +51,9 @@ public void encode(ChannelHandlerContext ctx, Packet packet, ByteBuf buf) {
5151
packetProtocol.getPacketHeader().writePacketId(buf, codecHelper, packetId);
5252
definition.getSerializer().serialize(buf, codecHelper, packet);
5353

54-
log.debug("Encoded packet with id: {}", packetId);
54+
if (log.isDebugEnabled()) {
55+
log.debug("Encoded packet {} ({})", packet.getClass().getSimpleName(), packetId);
56+
}
5557
} catch (Throwable t) {
5658
// Reset writer index to make sure incomplete data is not written out.
5759
buf.writerIndex(initial);
@@ -78,7 +80,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> out)
7880
return;
7981
}
8082

81-
log.debug("Decoding packet with id: {}", id);
83+
log.trace("Decoding packet with id: {}", id);
8284

8385
Packet packet = this.client ? packetRegistry.createClientboundPacket(id, buf, codecHelper) : packetRegistry.createServerboundPacket(id, buf, codecHelper);
8486

@@ -89,7 +91,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> out)
8991
out.add(packet);
9092

9193
if (log.isDebugEnabled()) {
92-
log.debug("Decoded packet: {}", packet.getClass().getSimpleName());
94+
log.debug("Decoded packet {} ({})", packet.getClass().getSimpleName(), id);
9395
}
9496
} catch (Throwable t) {
9597
// Advance buffer to end to make sure remaining data in this packet is skipped.

0 commit comments

Comments
 (0)