File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
src/main/java/xyz/theprogramsrc/supercoreapi Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
<groupId >xyz.theprogramsrc</groupId >
8
8
<artifactId >SuperCoreAPI</artifactId >
9
- <version >3.3.1 </version >
9
+ <version >3.3.2 </version >
10
10
<packaging >jar</packaging >
11
11
12
12
<name >SuperCoreAPI</name >
Original file line number Diff line number Diff line change 1
1
package xyz .theprogramsrc .supercoreapi ;
2
2
3
+ import org .apache .logging .log4j .LogManager ;
4
+ import org .apache .logging .log4j .core .Logger ;
5
+ import xyz .theprogramsrc .supercoreapi .global .LogsFilter ;
3
6
import xyz .theprogramsrc .supercoreapi .global .dependencies .DependencyManager ;
4
7
import xyz .theprogramsrc .supercoreapi .global .translations .TranslationManager ;
5
8
import xyz .theprogramsrc .supercoreapi .global .translations .TranslationPack ;
@@ -158,4 +161,13 @@ default String getPluginMessagingChannelName(){
158
161
* Stops the plugin
159
162
*/
160
163
void emergencyStop ();
164
+
165
+ /**
166
+ * Registers a log filter
167
+ * @param logsFilter the filter
168
+ */
169
+ default void registerLogFilter (LogsFilter logsFilter ){
170
+ Logger consoleLogger = (Logger ) LogManager .getRootLogger ();
171
+ consoleLogger .addFilter (logsFilter );
172
+ }
161
173
}
Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ public abstract class MySQLDataBase implements DataBase{
17
17
public MySQLDataBase (SuperPlugin <?> plugin ){
18
18
this .plugin = plugin ;
19
19
this .plugin .log ("Connecting to '" + getDataBaseSettings ().host () + ":" + getDataBaseSettings ().port ()+"'..." );
20
- new LogsFilter (LogsFilter .FilterResult .DENY , "com.zaxxer.hikari" );
20
+ if (this .hideHikariLogs ()){
21
+ this .plugin .registerLogFilter (new LogsFilter (LogsFilter .FilterResult .DENY , "com.zaxxer.hikari" ));
22
+ }
21
23
HikariConfig cfg = new HikariConfig ();
22
24
cfg .setJdbcUrl ("jdbc:mysql://" + getDataBaseSettings ().host () + ":" + getDataBaseSettings ().port () + "/" + getDataBaseSettings ().database () + "?useSSL=" + getDataBaseSettings ().useSSL ());
23
25
cfg .setUsername (getDataBaseSettings ().username ());
@@ -70,4 +72,11 @@ public void connect(ConnectionCall call) {
70
72
ex .printStackTrace ();
71
73
}
72
74
}
75
+
76
+ /**
77
+ * @return true to hide the hikaricp logs, otherwise false
78
+ */
79
+ public boolean hideHikariLogs (){
80
+ return true ;
81
+ }
73
82
}
You can’t perform that action at this time.
0 commit comments