reducing logging

This commit is contained in:
rusefillc 2022-01-05 15:56:04 -05:00
parent 3995d08bea
commit 5b5597a653
6 changed files with 42 additions and 12 deletions

Binary file not shown.

View File

@ -1,5 +1,6 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.output.JavaFieldsConsumer; import com.rusefi.output.JavaFieldsConsumer;
import com.rusefi.util.SystemOut; import com.rusefi.util.SystemOut;
import com.rusefi.test.ConfigFieldParserTest; import com.rusefi.test.ConfigFieldParserTest;
@ -9,12 +10,15 @@ import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.devexperts.logging.Logging.getLogging;
/** /**
* This is an immutable model of an individual field * This is an immutable model of an individual field
* Andrey Belomutskiy, (c) 2013-2020 * Andrey Belomutskiy, (c) 2013-2020
* 1/15/15 * 1/15/15
*/ */
public class ConfigField { public class ConfigField {
private static final Logging log = getLogging(ConfigField.class);
public static final ConfigField VOID = new ConfigField(null, "", null, null, null, new int[0], null, false, false, false, null, null); public static final ConfigField VOID = new ConfigField(null, "", null, null, null, new int[0], null, false, false, false, null, null);
private static final String typePattern = "([\\w\\d_]+)(\\[([\\w\\d]+)(\\sx\\s([\\w\\d]+))?(\\s([\\w\\d]+))?\\])?"; private static final String typePattern = "([\\w\\d_]+)(\\[([\\w\\d]+)(\\sx\\s([\\w\\d]+))?(\\s([\\w\\d]+))?\\])?";
@ -167,9 +171,12 @@ public class ConfigField {
ConfigField field = new ConfigField(state, name, comment, arraySizeAsText, type, arraySizes, ConfigField field = new ConfigField(state, name, comment, arraySizeAsText, type, arraySizes,
tsInfo, isIterate, isFsioVisible, hasAutoscale, null, null); tsInfo, isIterate, isFsioVisible, hasAutoscale, null, null);
SystemOut.println("type " + type); if (log.debugEnabled())
SystemOut.println("name " + name); log.debug("type " + type);
SystemOut.println("comment " + comment); if (log.debugEnabled())
log.debug("name " + name);
if (log.debugEnabled())
log.debug("comment " + comment);
return field; return field;
} }

View File

@ -11,5 +11,6 @@
<orderEntry type="library" exported="" name="junit" level="project" /> <orderEntry type="library" exported="" name="junit" level="project" />
<orderEntry type="library" exported="" name="snakeyaml" level="project" /> <orderEntry type="library" exported="" name="snakeyaml" level="project" />
<orderEntry type="module" module-name="logging" exported="" /> <orderEntry type="module" module-name="logging" exported="" />
<orderEntry type="module" module-name="logging-api" />
</component> </component>
</module> </module>

View File

@ -1,5 +1,6 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.enum_reader.Value; import com.rusefi.enum_reader.Value;
import com.rusefi.util.SystemOut; import com.rusefi.util.SystemOut;
@ -8,7 +9,10 @@ import org.jetbrains.annotations.NotNull;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import static com.devexperts.logging.Logging.getLogging;
public class EnumsReader { public class EnumsReader {
private static final Logging log = getLogging(EnumsReader.class);
private static final String ENUMCLASS_PREFIX = "enumclass"; private static final String ENUMCLASS_PREFIX = "enumclass";
protected final Map<String, EnumState> enums = new TreeMap<>(); protected final Map<String, EnumState> enums = new TreeMap<>();
@ -55,14 +59,16 @@ public class EnumsReader {
line = line.replaceAll("//.+", ""); line = line.replaceAll("//.+", "");
if (line.startsWith("typedefenum{") || line.startsWith("typedefenum__attribute__")) { if (line.startsWith("typedefenum{") || line.startsWith("typedefenum__attribute__")) {
SystemOut.println(" EnumsReader: Entering legacy enum"); if (log.debugEnabled())
log.debug(" EnumsReader: Entering legacy enum");
currentValues.clear(); currentValues.clear();
withAutoValue = false; withAutoValue = false;
isInsideEnum = true; isInsideEnum = true;
enumName = null; enumName = null;
isEnumClass = false; isEnumClass = false;
} else if (line.startsWith(ENUMCLASS_PREFIX)) { } else if (line.startsWith(ENUMCLASS_PREFIX)) {
SystemOut.println(" EnumsReader: Entering fancy enum class"); if (log.debugEnabled())
log.debug(" EnumsReader: Entering fancy enum class");
currentValues.clear(); currentValues.clear();
withAutoValue = false; withAutoValue = false;
isInsideEnum = true; isInsideEnum = true;
@ -75,7 +81,8 @@ public class EnumsReader {
isInsideEnum = false; isInsideEnum = false;
if (enumName == null) if (enumName == null)
enumName = line.substring(1, line.length() - 1); enumName = line.substring(1, line.length() - 1);
SystemOut.println(" EnumsReader: Ending enum " + enumName + " found " + currentValues.size() + " values"); if (log.debugEnabled())
log.debug(" EnumsReader: Ending enum " + enumName + " found " + currentValues.size() + " values");
if (withAutoValue) if (withAutoValue)
validateValues(currentValues); validateValues(currentValues);
@ -93,10 +100,12 @@ public class EnumsReader {
value = Integer.toString(currentValues.size()); value = Integer.toString(currentValues.size());
withAutoValue = true; withAutoValue = true;
} }
SystemOut.println(" EnumsReader: Line " + line); if (log.debugEnabled())
log.debug(" EnumsReader: Line " + line);
currentValues.put(line, new Value(line, value)); currentValues.put(line, new Value(line, value));
} else { } else {
SystemOut.println(" EnumsReader: Skipping Line " + line); if (log.debugEnabled())
log.debug(" EnumsReader: Skipping Line " + line);
} }
} }
} }

View File

@ -1,10 +1,14 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.util.LazyFile; import com.rusefi.util.LazyFile;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import static com.devexperts.logging.Logging.getLogging;
public class ToolUtil { public class ToolUtil {
private static final Logging log = getLogging(ToolUtil.class);
public static final String EOL = "\n"; public static final String EOL = "\n";
public static String TOOL = "(unknown script)"; public static String TOOL = "(unknown script)";
@ -18,7 +22,8 @@ public class ToolUtil {
.getLocation() .getLocation()
.toURI() .toURI()
.getPath(); .getPath();
System.out.println("JAR Path : " + jarPath); if (log.debugEnabled())
log.debug("JAR Path : " + jarPath);
// Get name of the JAR file // Get name of the JAR file
return jarPath.substring(jarPath.lastIndexOf("/") + 1); return jarPath.substring(jarPath.lastIndexOf("/") + 1);

View File

@ -1,5 +1,6 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.enum_reader.Value; import com.rusefi.enum_reader.Value;
import com.rusefi.util.SystemOut; import com.rusefi.util.SystemOut;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -14,10 +15,14 @@ import java.util.TreeMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.devexperts.logging.Logging.getLogging;
/** /**
* 3/30/2015 * 3/30/2015
*/ */
public class VariableRegistry { public class VariableRegistry {
private static final Logging log = getLogging(VariableRegistry.class);
public static final String _16_HEX_SUFFIX = "_16_hex"; public static final String _16_HEX_SUFFIX = "_16_hex";
public static final String _HEX_SUFFIX = "_hex"; public static final String _HEX_SUFFIX = "_hex";
public static final String CHAR_SUFFIX = "_char"; public static final String CHAR_SUFFIX = "_char";
@ -154,7 +159,8 @@ public class VariableRegistry {
@Nullable @Nullable
private String doRegister(String var, String value) { private String doRegister(String var, String value) {
if (data.containsKey(var)) { if (data.containsKey(var)) {
SystemOut.println("Not redefining " + var); if (log.debugEnabled())
log.debug("Not redefining " + var);
return null; return null;
} }
value = applyVariables(value); value = applyVariables(value);
@ -165,7 +171,8 @@ public class VariableRegistry {
value = String.valueOf(first * second); value = String.valueOf(first * second);
} }
SystemOut.println("Registering " + var + " as " + value); if (log.debugEnabled())
log.debug("Registering " + var + " as " + value);
data.put(var, value); data.put(var, value);
if (!value.contains("\n")) { if (!value.contains("\n")) {
@ -197,7 +204,8 @@ public class VariableRegistry {
try { try {
int intValue = Integer.parseInt(value); int intValue = Integer.parseInt(value);
SystemOut.println("key [" + var + "] value: " + intValue); if (log.debugEnabled())
log.debug("key [" + var + "] value: " + intValue);
intValues.put(var, intValue); intValues.put(var, intValue);
if (!var.endsWith(_HEX_SUFFIX)) { if (!var.endsWith(_HEX_SUFFIX)) {
javaDefinitions.put(var, "\tpublic static final int " + var + " = " + intValue + ";" + ToolUtil.EOL); javaDefinitions.put(var, "\tpublic static final int " + var + " = " + intValue + ";" + ToolUtil.EOL);