diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-08-03 00:40:30 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-08-05 00:42:23 +0900 |
| commit | 2d8b613a3ad48acafd683f5286e29c3f1c167275 (patch) | |
| tree | 3c381a29d539e35504ef3f63f69dd37086a59035 /platform-paper | |
| parent | e8b44cf42888cc00c67d885c3d641ca1a8f78034 (diff) | |
| download | LunaticChat-2d8b613a3ad48acafd683f5286e29c3f1c167275.tar.gz LunaticChat-2d8b613a3ad48acafd683f5286e29c3f1c167275.tar.bz2 LunaticChat-2d8b613a3ad48acafd683f5286e29c3f1c167275.zip | |
perf: take per-message logging off the chat path
Every channel message wrote a fully interpolated INFO line, duplicating
what the dedicated async ChannelMessageLogger already persists. Every
cross-server message produced one INFO on the sending Paper server, two on
Velocity, and one on each receiving Paper server - so a single global chat
message cost up to four synchronous console and latest.log writes across
the network, on the message path, with JUL and Logback appenders being
synchronous.
These are now debug, and phrased so the string is not built unless debug
is on: the JUL sites take a supplier, the slf4j sites take a format plus
arguments.
Handshake, registration and delivery-failure lines stay at info - they
fire once per server or once per failed message, and they explain
something an operator needs to see.
Two relay tests asserted on the text of a log line. One of them was
verifying "0 servers" where the same test already verifies zero sends;
the other was really checking that the payload reaches the target, so it
now decodes the relayed bytes and compares them to the original message.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'platform-paper')
3 files changed, 8 insertions, 8 deletions
diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt index 985f321..4cfd061 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt @@ -75,7 +75,7 @@ class ChannelMessageHandler( } } - logger.info("Channel Message from ${player.name} in ${context.channel.name}: $message") + logger.debug("Channel Message from {} in {}: {}", player.name, context.channel.name, message) // Log message to file if logging is enabled messageLogger?.let { diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt index 2f2bde0..19668be 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt @@ -69,7 +69,7 @@ class CrossServerChatManager( PluginMessageChannel.ID, PluginMessageCodec.encode(globalChatMessage), ) - logger.info("Sent global chat message to Velocity: messageId=$messageId, player=$playerName") + logger.fine { "Sent global chat message to Velocity: messageId=$messageId, player=$playerName" } } else { logger.warning("Cannot send global chat message: player $playerId not found") } @@ -109,10 +109,10 @@ class CrossServerChatManager( }, ) - logger.info( + logger.fine { "Broadcasted global chat message from ${message.serverName}: " + - "player=${message.playerName}, messageId=${message.messageId}", - ) + "player=${message.playerName}, messageId=${message.messageId}" + } } catch (e: Exception) { logger.log(Level.SEVERE, "Failed to handle incoming global chat message", e) } diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt index b35f6a5..76cc879 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt @@ -69,10 +69,10 @@ class CrossServerDirectMessageManager( ) sender.sendPluginMessage(plugin, PluginMessageChannel.ID, PluginMessageCodec.encode(relay)) - logger.info( + logger.fine { "Sent direct message to Velocity: messageId=$messageId, " + - "target=$targetName@$targetServerName", - ) + "target=$targetName@$targetServerName" + } } catch (e: Exception) { logger.log(Level.SEVERE, "Failed to send cross-server direct message", e) } |
