From 531b35f6b78f1640a4dd903ad41da4f134da0358 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Tue, 18 Feb 2020 16:34:14 +0100 Subject: [PATCH] Adjusted logging locations and levels --- src/main/java/envoy/client/data/Cache.java | 2 +- src/main/java/envoy/client/net/Client.java | 6 +++--- .../envoy/client/net/MessageStatusChangeEventProcessor.java | 2 +- src/main/java/envoy/client/net/Receiver.java | 2 +- src/main/java/envoy/client/net/WriteProxy.java | 4 ++-- src/main/java/envoy/client/ui/ChatWindow.java | 1 - .../java/envoy/client/ui/settings/GeneralSettingsPanel.java | 2 +- src/main/java/envoy/client/util/EnvoyLog.java | 1 - 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/envoy/client/data/Cache.java b/src/main/java/envoy/client/data/Cache.java index 078c377..a727d01 100644 --- a/src/main/java/envoy/client/data/Cache.java +++ b/src/main/java/envoy/client/data/Cache.java @@ -35,7 +35,7 @@ public class Cache implements Consumer, Serializable { */ @Override public void accept(T element) { - logger.info(String.format("Adding element %s to cache", element)); + logger.fine(String.format("Adding element %s to cache", element)); elements.offer(element); } diff --git a/src/main/java/envoy/client/net/Client.java b/src/main/java/envoy/client/net/Client.java index 5cd1b15..7a7f960 100644 --- a/src/main/java/envoy/client/net/Client.java +++ b/src/main/java/envoy/client/net/Client.java @@ -77,8 +77,8 @@ public class Client implements Closeable { receiver = new Receiver(socket.getInputStream()); // Register user creation processor, contact list processor and message cache - receiver.registerProcessor(User.class, sender -> { logger.info("Acquired user object " + sender); this.sender = sender; }); - receiver.registerProcessor(Contacts.class, contacts -> { logger.info("Acquired contacts object " + contacts); this.contacts = contacts; }); + receiver.registerProcessor(User.class, sender -> this.sender = sender); + receiver.registerProcessor(Contacts.class, contacts -> this.contacts = contacts); receiver.registerProcessor(Message.class, receivedMessageCache); receiver.registerProcessor(HandshakeRejectionEvent.class, evt -> { rejected = true; EventBus.getInstance().dispatch(evt); }); @@ -88,7 +88,6 @@ public class Client implements Closeable { new Thread(receiver).start(); // Write login credentials - logger.finest("Sending login credentials..."); SerializationUtils.writeBytesWithLength(credentials, socket.getOutputStream()); // Wait for a maximum of five seconds to acquire the sender object @@ -225,6 +224,7 @@ public class Client implements Closeable { private void writeObject(Object obj) throws IOException { checkOnline(); + logger.fine("Sending object " + obj); SerializationUtils.writeBytesWithLength(obj, socket.getOutputStream()); } diff --git a/src/main/java/envoy/client/net/MessageStatusChangeEventProcessor.java b/src/main/java/envoy/client/net/MessageStatusChangeEventProcessor.java index 774b06b..8197d53 100644 --- a/src/main/java/envoy/client/net/MessageStatusChangeEventProcessor.java +++ b/src/main/java/envoy/client/net/MessageStatusChangeEventProcessor.java @@ -29,7 +29,7 @@ public class MessageStatusChangeEventProcessor implements Consumer { try { - logger.info("Sending cached " + msg); + logger.finer("Sending cached " + msg); client.sendMessage(msg); } catch (IOException e) { logger.log(Level.SEVERE, "Could not send cached message", e); } }); localDb.getStatusCache().setProcessor(evt -> { - logger.info("Sending cached " + evt); + logger.finer("Sending cached " + evt); try { client.sendEvent(evt); } catch (IOException e) { diff --git a/src/main/java/envoy/client/ui/ChatWindow.java b/src/main/java/envoy/client/ui/ChatWindow.java index 3602283..22ab504 100644 --- a/src/main/java/envoy/client/ui/ChatWindow.java +++ b/src/main/java/envoy/client/ui/ChatWindow.java @@ -390,7 +390,6 @@ public class ChatWindow extends JFrame { EventBus.getInstance().register(ContactSearchResult.class, evt -> { contactsModel.clear(); final java.util.List contacts = evt.get(); - logger.info("Received contact search result " + contacts); contacts.forEach(contactsModel::add); revalidate(); repaint(); diff --git a/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java b/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java index fc91740..f4537b3 100644 --- a/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java +++ b/src/main/java/envoy/client/ui/settings/GeneralSettingsPanel.java @@ -89,5 +89,5 @@ public class GeneralSettingsPanel extends SettingsPanel { } @Override - public ActionListener getOkButtonAction() { return (evt) -> {}; } + public ActionListener getOkButtonAction() { return evt -> {}; } } \ No newline at end of file diff --git a/src/main/java/envoy/client/util/EnvoyLog.java b/src/main/java/envoy/client/util/EnvoyLog.java index c9ef8cd..3cbb856 100644 --- a/src/main/java/envoy/client/util/EnvoyLog.java +++ b/src/main/java/envoy/client/util/EnvoyLog.java @@ -84,7 +84,6 @@ public class EnvoyLog { * @since Envoy v0.2-alpha */ public static Logger getLogger(Class logClass) { - // Get a logger with the specified class name return Logger.getLogger(logClass.getCanonicalName()); }