Skip to content

Commit b8acd9c

Browse files
gheatheringtonJRoy
andauthored
Allow discord console relay to be filtered by logger name (#6448)
Rearranged logger addition to message entry for filtering by logger name. --------- Co-authored-by: Josh Roy <[email protected]>
1 parent f080f81 commit b8acd9c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

EssentialsDiscord/src/main/java/net/essentialsx/discord/util/ConsoleInjector.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ public void append(LogEvent event) {
124124
return;
125125
}
126126

127+
final String[] loggerNameSplit = event.getLoggerName().split("\\.");
128+
final String loggerName = loggerNameSplit[loggerNameSplit.length - 1].trim();
129+
130+
if (!loggerName.isEmpty()) {
131+
entry = "[" + loggerName + "] " + entry;
132+
}
133+
127134
if (!jda.getSettings().getConsoleFilters().isEmpty()) {
128135
for (final Pattern pattern : jda.getSettings().getConsoleFilters()) {
129136
if (pattern.matcher(entry).find()) {
@@ -132,13 +139,6 @@ public void append(LogEvent event) {
132139
}
133140
}
134141

135-
final String[] loggerNameSplit = event.getLoggerName().split("\\.");
136-
final String loggerName = loggerNameSplit[loggerNameSplit.length - 1].trim();
137-
138-
if (!loggerName.isEmpty()) {
139-
entry = "[" + loggerName + "] " + entry;
140-
}
141-
142142
messageQueue.addAll(Splitter.fixedLength(Message.MAX_CONTENT_LENGTH - 50).splitToList(
143143
MessageUtil.formatMessage(jda.getSettings().getConsoleFormat(),
144144
TimeFormat.TIME_LONG.format(Instant.now()),

0 commit comments

Comments
 (0)