Console logging is a mess #3930
This commit is contained in:
parent
f731a26391
commit
8677be4177
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.io;
|
||||
|
||||
import com.rusefi.FileLog;
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.RusEfiSignature;
|
||||
import com.rusefi.SignatureHelper;
|
||||
import com.rusefi.autoupdate.Autoupdate;
|
||||
|
@ -11,10 +11,12 @@ import com.rusefi.ui.StatusConsumer;
|
|||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.Timeouts.SECOND;
|
||||
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
|
||||
|
||||
public class DfuHelper {
|
||||
private static final Logging log = getLogging(DfuHelper.class);
|
||||
private static final String PREFIX = "rusefi_bundle";
|
||||
|
||||
public static void sendDfuRebootCommand(IoStream stream, StatusConsumer messages) {
|
||||
|
@ -41,7 +43,7 @@ public class DfuHelper {
|
|||
|
||||
if (!bundleName.equalsIgnoreCase(signatureWithPrefix)) {
|
||||
String message = String.format("You have \"%s\" controller does not look right to program it with \"%s\"", s.getBundle(), bundleName);
|
||||
FileLog.MAIN.logLine(message);
|
||||
log.info(message);
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(parent, message);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.autodetect.PortDetector;
|
||||
import com.rusefi.autoupdate.AutoupdateUtil;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocolLogger;
|
||||
|
@ -13,6 +14,7 @@ import com.rusefi.io.serial.BaudRateHolder;
|
|||
import com.rusefi.maintenance.FirmwareFlasher;
|
||||
import com.rusefi.maintenance.VersionChecker;
|
||||
import com.rusefi.ui.*;
|
||||
import com.rusefi.ui.config.BaseConfigField;
|
||||
import com.rusefi.ui.console.MainFrame;
|
||||
import com.rusefi.ui.console.TabbedPanel;
|
||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||
|
@ -30,6 +32,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.StartupFrame.setFrameIcon;
|
||||
import static com.rusefi.rusEFIVersion.CONSOLE_VERSION;
|
||||
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||
|
@ -38,6 +41,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see StartupFrame
|
||||
*/
|
||||
public class ConsoleUI {
|
||||
private static final Logging log = getLogging(ConsoleUI.class);
|
||||
private static final int DEFAULT_TAB_INDEX = 0;
|
||||
private static SensorCentral.SensorListener wrongVersionListener;
|
||||
|
||||
|
@ -68,9 +72,9 @@ public class ConsoleUI {
|
|||
MainFrame mainFrame = new MainFrame(this, tabbedPane);
|
||||
ConsoleUI.staticFrame = mainFrame.getFrame().getFrame();
|
||||
setFrameIcon(ConsoleUI.staticFrame);
|
||||
FileLog.MAIN.logLine("Console " + CONSOLE_VERSION);
|
||||
log.info("Console " + CONSOLE_VERSION);
|
||||
|
||||
FileLog.MAIN.logLine("Hardware: " + FirmwareFlasher.getHardwareKind());
|
||||
log.info("Hardware: " + FirmwareFlasher.getHardwareKind());
|
||||
|
||||
getConfig().getRoot().setProperty(PORT_KEY, port);
|
||||
getConfig().getRoot().setProperty(SPEED_KEY, BaudRateHolder.INSTANCE.baudRate);
|
||||
|
@ -89,7 +93,7 @@ public class ConsoleUI {
|
|||
// TODO: this is a race if the ECU is slow to connect
|
||||
new ConnectionWatchdog(Timeouts.CONNECTION_RESTART_DELAY, () -> {
|
||||
uiContext.getLinkManager().execute(() -> {
|
||||
FileLog.MAIN.logLine("ConnectionWatchdog.reconnectTimer restarting: " + Timeouts.CONNECTION_RESTART_DELAY);
|
||||
log.info("ConnectionWatchdog.reconnectTimer restarting: " + Timeouts.CONNECTION_RESTART_DELAY);
|
||||
linkManager.restart();
|
||||
});
|
||||
}).start();
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.FieldPosition;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
public final class Histograms {
|
||||
private static final Logging log = getLogging(Histograms.class);
|
||||
private static final String MAGIC = "total";
|
||||
public static final double H_ACCURACY = 0.05;
|
||||
public static final int BOUND_LENGTH = (int) (Math.log(Long.MAX_VALUE) / Math.log(1.0 + H_ACCURACY));
|
||||
|
@ -115,7 +119,7 @@ public final class Histograms {
|
|||
confidence_bounds = new double[]{0.5 - H_CONFIDENCE * 0.5, 0.5, 0.5 + H_CONFIDENCE * 0.5};
|
||||
confidence_separators = new String[]{"(", " [", "-", "-", "] ", ")"};
|
||||
|
||||
FileLog.MAIN.logLine("BOUND_LENGTH=" + BOUND_LENGTH);
|
||||
log.info("BOUND_LENGTH=" + BOUND_LENGTH);
|
||||
|
||||
bounds = new long[BOUND_LENGTH];
|
||||
bounds[0] = 0;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.ui.RpmLabel;
|
||||
import com.rusefi.ui.RpmModel;
|
||||
|
@ -19,11 +20,14 @@ import java.awt.event.ActionListener;
|
|||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
/**
|
||||
* Date: 12/21/13
|
||||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
*/
|
||||
public class SensorSnifferPane {
|
||||
private static final Logging log = getLogging(SensorSnifferPane.class);
|
||||
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Analog_Chart";
|
||||
|
||||
private final TreeMap<Double, Double> values = new TreeMap<>();
|
||||
|
@ -127,7 +131,7 @@ public class SensorSnifferPane {
|
|||
List<Double> keys = new ArrayList<>(values.keySet());
|
||||
minX = keys.get(0);
|
||||
maxX = keys.get(keys.size() - 1);
|
||||
FileLog.MAIN.logLine("Analog chart from " + minX + " to " + maxX);
|
||||
log.info("Analog chart from " + minX + " to " + maxX);
|
||||
|
||||
TreeSet<Double> sortedValues = new TreeSet<>(values.values());
|
||||
List<Double> values = new ArrayList<>(sortedValues);
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.rusefi.ui.config;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.opensr5.ConfigurationImage;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.config.Field;
|
||||
import com.rusefi.io.CommandQueue;
|
||||
import com.rusefi.io.ConnectionStatusLogic;
|
||||
import com.rusefi.io.DfuHelper;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.ui.UIContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -14,7 +16,11 @@ import javax.swing.*;
|
|||
import java.awt.*;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
public abstract class BaseConfigField {
|
||||
private static final Logging log = getLogging(BaseConfigField.class);
|
||||
|
||||
protected final JLabel status = new JLabel("P");
|
||||
private final JPanel panel = new JPanel(new BorderLayout());
|
||||
private final UIContext uiContext;
|
||||
|
@ -49,7 +55,7 @@ public abstract class BaseConfigField {
|
|||
|
||||
protected void sendValue(Field field, String newValue) {
|
||||
String msg = field.setCommand() + " " + newValue;
|
||||
FileLog.MAIN.logLine("Sending " + msg);
|
||||
log.info("Sending " + msg);
|
||||
uiContext.getCommandQueue().write(msg);
|
||||
status.setText("S");
|
||||
status.setToolTipText("Storing...");
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.rusefi.ui.engine;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.core.EngineState;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.ui.*;
|
||||
import com.rusefi.ui.config.BaseConfigField;
|
||||
import com.rusefi.ui.config.BitConfigField;
|
||||
import com.rusefi.ui.config.ConfigField;
|
||||
import com.rusefi.ui.storage.Node;
|
||||
|
@ -23,6 +25,8 @@ import java.awt.event.ActionListener;
|
|||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
/**
|
||||
* Engine Sniffer control consists of a set of {@link UpDownImage}
|
||||
* <p/>
|
||||
|
@ -34,6 +38,7 @@ import java.util.List;
|
|||
* @see com.rusefi.ui.test.WavePanelSandbox
|
||||
*/
|
||||
public class EngineSnifferPanel {
|
||||
private static final Logging log = getLogging(EngineSnifferPanel.class);
|
||||
private static final int EFI_DEFAULT_CHART_SIZE = 180;
|
||||
public static final Comparator<String> INSTANCE = new ImageOrderComparator();
|
||||
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Digital_Chart";
|
||||
|
@ -239,7 +244,7 @@ public class EngineSnifferPanel {
|
|||
|
||||
int index = getInsertIndex(name, images.keySet());
|
||||
|
||||
FileLog.MAIN.logLine("Engine sniffer register channel " + name + " at idx " + index);
|
||||
log.info("Engine sniffer register channel " + name + " at idx " + index);
|
||||
|
||||
UpDownImage image = createImage(name);
|
||||
images.put(name, image);
|
||||
|
|
Loading…
Reference in New Issue