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;
import com.devexperts.logging.Logging;
import com.rusefi.output.JavaFieldsConsumer;
import com.rusefi.util.SystemOut;
import com.rusefi.test.ConfigFieldParserTest;
@ -9,12 +10,15 @@ import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.devexperts.logging.Logging.getLogging;
/**
* This is an immutable model of an individual field
* Andrey Belomutskiy, (c) 2013-2020
* 1/15/15
*/
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);
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,
tsInfo, isIterate, isFsioVisible, hasAutoscale, null, null);
SystemOut.println("type " + type);
SystemOut.println("name " + name);
SystemOut.println("comment " + comment);
if (log.debugEnabled())
log.debug("type " + type);
if (log.debugEnabled())
log.debug("name " + name);
if (log.debugEnabled())
log.debug("comment " + comment);
return field;
}

View File

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

View File

@ -1,5 +1,6 @@
package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.enum_reader.Value;
import com.rusefi.util.SystemOut;
@ -8,7 +9,10 @@ import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.util.*;
import static com.devexperts.logging.Logging.getLogging;
public class EnumsReader {
private static final Logging log = getLogging(EnumsReader.class);
private static final String ENUMCLASS_PREFIX = "enumclass";
protected final Map<String, EnumState> enums = new TreeMap<>();
@ -55,14 +59,16 @@ public class EnumsReader {
line = line.replaceAll("//.+", "");
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();
withAutoValue = false;
isInsideEnum = true;
enumName = null;
isEnumClass = false;
} 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();
withAutoValue = false;
isInsideEnum = true;
@ -75,7 +81,8 @@ public class EnumsReader {
isInsideEnum = false;
if (enumName == null)
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)
validateValues(currentValues);
@ -93,10 +100,12 @@ public class EnumsReader {
value = Integer.toString(currentValues.size());
withAutoValue = true;
}
SystemOut.println(" EnumsReader: Line " + line);
if (log.debugEnabled())
log.debug(" EnumsReader: Line " + line);
currentValues.put(line, new Value(line, value));
} 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;
import com.devexperts.logging.Logging;
import com.rusefi.util.LazyFile;
import java.net.URISyntaxException;
import static com.devexperts.logging.Logging.getLogging;
public class ToolUtil {
private static final Logging log = getLogging(ToolUtil.class);
public static final String EOL = "\n";
public static String TOOL = "(unknown script)";
@ -18,7 +22,8 @@ public class ToolUtil {
.getLocation()
.toURI()
.getPath();
System.out.println("JAR Path : " + jarPath);
if (log.debugEnabled())
log.debug("JAR Path : " + jarPath);
// Get name of the JAR file
return jarPath.substring(jarPath.lastIndexOf("/") + 1);

View File

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