From 1921abd310a3a945d8847e72b041be025b0bc92a Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:06:13 -0400 Subject: [PATCH] Shorten logger names for Discord module console relay --- .../java/net/essentialsx/discord/util/ConsoleInjector.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/EssentialsDiscord/src/main/java/net/essentialsx/discord/util/ConsoleInjector.java b/EssentialsDiscord/src/main/java/net/essentialsx/discord/util/ConsoleInjector.java index c6e52d10a..e60689c7d 100644 --- a/EssentialsDiscord/src/main/java/net/essentialsx/discord/util/ConsoleInjector.java +++ b/EssentialsDiscord/src/main/java/net/essentialsx/discord/util/ConsoleInjector.java @@ -78,9 +78,10 @@ public class ConsoleInjector extends AbstractAppender { } } - final String loggerName = event.getLoggerName(); - if (!loggerName.isEmpty() && !loggerName.contains(".")) { - entry = "[" + event.getLoggerName() + "] " + entry; + final String[] loggerNameSplit = event.getLoggerName().split("\\."); + final String loggerName = loggerNameSplit[loggerNameSplit.length - 1].trim(); + if (!loggerName.isEmpty()) { + entry = "[" + loggerName + "] " + entry; } messageQueue.addAll(Splitter.fixedLength(Message.MAX_CONTENT_LENGTH - 50).splitToList(