Switch to disable logging with the off level

This commit is contained in:
nathanrsxtn
2022-04-04 01:39:06 -06:00
parent b5f57a09ff
commit 3ad6d3d216
2 changed files with 3 additions and 5 deletions
@@ -563,7 +563,7 @@ public class DriverStation {
boolean printTrace,
StackTraceElement[] stackTrace,
int stackTraceFirst) {
if (frc4388.utility.AnsiLogging.ENABLED) {
if (frc4388.utility.AnsiLogging.LEVEL.equals(java.util.logging.Level.OFF)) {
java.util.logging.LogRecord logRecord = new java.util.logging.LogRecord(isError ? java.util.logging.Level.SEVERE : java.util.logging.Level.FINER, error.stripTrailing());
logRecord.setLoggerName("HAL");
if (!frc4388.utility.AnsiLogging.halLoggerHandler.isLoggable(logRecord)) return;
@@ -29,14 +29,12 @@ import org.fusesource.jansi.AnsiConsole;
import org.fusesource.jansi.AnsiPrintStream;
public class AnsiLogging {
public static final boolean ENABLED = true;
public static final Level LEVEL = Level.ALL;
private static final AnsiPrintStream ANSI_CONSOLE_STREAM = AnsiConsole.err();
private static final Level LEVEL = Level.ALL;
public static Handler halLoggerHandler = new ConsoleHandler();
public static void systemInstall() {
if (!ENABLED) return;
if (LEVEL.equals(Level.OFF)) return;
try {
// Configure java.util.logging.Logger to output additional colored information.
LogManager.getLogManager().updateConfiguration(key -> (o, n) -> {