File tree Expand file tree Collapse file tree
core/src/main/java/edu/wpi/grip/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 * A Guice {@link com.google.inject.Module} for GRIP's core package. This is where instances of {@link Pipeline},
2424 * {@link Palette}, {@link Project}, etc... are created.
2525 */
26+ @ SuppressWarnings ("PMD.MoreThanOneLogger" )
2627public class GRIPCoreModule extends AbstractModule {
2728 private final Logger logger = Logger .getLogger (GRIPCoreModule .class .getName ());
2829
2930 private final EventBus eventBus = new EventBus (this ::onSubscriberException );
3031
31- public GRIPCoreModule () {
32+ // This is in a static initialization block so that we don't create a ton of
33+ // log files when running tests
34+ static {
3235 //Set up the global level logger. This handles IO for all loggers.
33- final Logger globalLogger = LogManager .getLogManager ().getLogger ("" );//This is our global logger
36+ final Logger globalLogger = LogManager .getLogManager ().getLogger ("" );
3437
3538 try {
3639 // Remove the default handlers that stream to System.err
@@ -69,7 +72,10 @@ public synchronized void publish(final LogRecord record) {
6972 } catch (IOException exception ) {//Something happened setting up file IO
7073 throw new IllegalStateException ("Failed to configure the Logger" , exception );
7174 }
75+ }
7276
77+ public GRIPCoreModule () {
78+ // TODO: HACK! Don't assign the global thread handler to an instance method. Creates global state.
7379 Thread .setDefaultUncaughtExceptionHandler (this ::onThreadException );
7480 }
7581
You can’t perform that action at this time.
0 commit comments