From 3f3ee0ef194b2cdcfce89b105a4d109ae6c1419b Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 25 Jul 2020 10:32:23 -0400 Subject: [PATCH] java logging migration --- .../com/rusefi/binaryprotocol/BinaryProtocol.java | 6 ++++-- .../java/com/rusefi/proxy/NetworkConnector.java | 15 ++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java index 5cc5c561a6..d1c8ec3579 100644 --- a/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java +++ b/java_console/io/src/main/java/com/rusefi/binaryprotocol/BinaryProtocol.java @@ -10,10 +10,12 @@ import com.rusefi.Timeouts; import com.rusefi.composite.CompositeEvent; import com.rusefi.composite.CompositeParser; import com.rusefi.config.generated.Fields; -import com.rusefi.core.*; +import com.rusefi.core.MessagesCentral; +import com.rusefi.core.Pair; +import com.rusefi.core.Sensor; +import com.rusefi.core.SensorCentral; import com.rusefi.io.*; import com.rusefi.io.commands.GetOutputsCommand; -import com.rusefi.io.serial.PortHolder; import com.rusefi.stream.LogicdataStreamFile; import com.rusefi.stream.StreamFile; import com.rusefi.stream.TSHighSpeedLog; diff --git a/java_tools/proxy_server/src/main/java/com/rusefi/proxy/NetworkConnector.java b/java_tools/proxy_server/src/main/java/com/rusefi/proxy/NetworkConnector.java index 1728524d3f..7e25684d84 100644 --- a/java_tools/proxy_server/src/main/java/com/rusefi/proxy/NetworkConnector.java +++ b/java_tools/proxy_server/src/main/java/com/rusefi/proxy/NetworkConnector.java @@ -1,7 +1,7 @@ package com.rusefi.proxy; +import com.devexperts.logging.Logging; import com.opensr5.ConfigurationImage; -import com.opensr5.Logger; import com.rusefi.binaryprotocol.BinaryProtocol; import com.rusefi.config.generated.Fields; import com.rusefi.io.ConnectionStateListener; @@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit; * see NetworkConnectorStartup */ public class NetworkConnector { + private final static Logging log = Logging.getLogging(NetworkConnector.class); public static SessionDetails runNetworkConnector(String authToken, String controllerPort, int serverPortForControllers, TcpIoStream.DisconnectListener disconnectListener) throws InterruptedException, IOException { LinkManager controllerConnector = new LinkManager() .setCompositeLogicEnabled(false) @@ -43,18 +44,18 @@ public class NetworkConnector { } }); - Logger.CONSOLE.info("Connecting to controller..."); + log.info("Connecting to controller..."); onConnected.await(1, TimeUnit.MINUTES); if (onConnected.getCount() != 0) { - Logger.CONSOLE.info("Connection to controller failed"); + log.info("Connection to controller failed"); return null; } - return runNetworkConnector(serverPortForControllers, controllerConnector, Logger.CONSOLE, authToken, disconnectListener); + return runNetworkConnector(serverPortForControllers, controllerConnector, authToken, disconnectListener); } @NotNull - private static SessionDetails runNetworkConnector(int serverPortForControllers, LinkManager linkManager, final Logger logger, String authToken, final TcpIoStream.DisconnectListener disconnectListener) throws IOException { + private static SessionDetails runNetworkConnector(int serverPortForControllers, LinkManager linkManager, String authToken, final TcpIoStream.DisconnectListener disconnectListener) throws IOException { IoStream targetEcuSocket = linkManager.getConnector().getBinaryProtocol().getStream(); HelloCommand.send(targetEcuSocket); String helloResponse = HelloCommand.getHelloResponse(targetEcuSocket.getDataBuffer()); @@ -76,11 +77,11 @@ public class NetworkConnector { @Override protected void handleCommand(BinaryProtocolServer.Packet packet, TcpIoStream stream) throws IOException { super.handleCommand(packet, stream); - logger.info("Relaying request to controller " + BinaryProtocol.findCommand(packet.getPacket()[0])); + log.info("Relaying request to controller " + BinaryProtocol.findCommand(packet.getPacket()[0])); targetEcuSocket.sendPacket(packet); BinaryProtocolServer.Packet response = targetEcuSocket.readPacket(); - logger.info("Relaying response to proxy size=" + response.getPacket().length); + log.info("Relaying response to proxy size=" + response.getPacket().length); stream.sendPacket(response); } };