forked from TheCurle/Camelot
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff3eaea
commit 58be7bc
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/net/neoforged/camelot/util/LoggingFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.neoforged.camelot.util; | ||
|
||
import ch.qos.logback.classic.spi.ILoggingEvent; | ||
import ch.qos.logback.core.filter.Filter; | ||
import ch.qos.logback.core.spi.FilterReply; | ||
|
||
/** | ||
* A Logback filter that filters out unneeded messages. | ||
*/ | ||
public class LoggingFilter extends Filter<ILoggingEvent> { | ||
@Override | ||
public FilterReply decide(ILoggingEvent event) { | ||
return test(event) ? FilterReply.NEUTRAL : FilterReply.DENY; | ||
} | ||
|
||
private boolean test(ILoggingEvent event) { | ||
return switch (event.getLoggerName()) { | ||
case "org.flywaydb.core.internal.command.DbMigrate" -> !event.getMessage().endsWith("No migration necessary."); | ||
case "org.flywaydb.core.internal.command.DbValidate" -> !event.getMessage().startsWith("Successfully validated"); | ||
|
||
case "io.javalin.Javalin" -> !event.getMessage().equals("Your JDK supports Loom. Javalin will prefer Virtual Threads by default. Disable with `ConcurrencyUtil.useLoom = false`.") | ||
&& !event.getMessage().startsWith("Static file handler added:"); | ||
default -> true; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters