1
0
forked from Clones/Controlify

✏️ Only print debug info if non-default

This commit is contained in:
isXander
2023-05-07 12:43:23 +01:00
parent f958a2b1b6
commit de2d1effac

View File

@ -22,7 +22,7 @@ public class DebugProperties {
public static final boolean PRINT_DRIVER = boolProp("controlify.debug.print_driver", true, true);
public static void printProperties() {
if (properties.stream().noneMatch(DebugProperty::enabled))
if (properties.stream().noneMatch(prop -> prop.enabled() != prop.def()))
return;
String header = "*----------------- Controlify Debug Properties -----------------*";
@ -42,10 +42,10 @@ public class DebugProperties {
private static boolean boolProp(String name, boolean defProd, boolean defDev) {
boolean def = FabricLoader.getInstance().isDevelopmentEnvironment() ? defDev : defProd;
boolean enabled = Boolean.parseBoolean(System.getProperty(name, Boolean.toString(def)));
properties.add(new DebugProperty(name, enabled));
properties.add(new DebugProperty(name, enabled, def));
return enabled;
}
private record DebugProperty(String name, boolean enabled) {
private record DebugProperty(String name, boolean enabled, boolean def) {
}
}