From 2da04adfea09475fb66f4718ff577c2ceb9999a1 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 1 Feb 2018 12:02:03 -0500 Subject: [PATCH] Enabling and disabling log printing in the SubscriptionMessagesHub --- .../graphenej/api/SubscriptionMessagesHub.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java index 1509be3..b6e3b43 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java @@ -61,6 +61,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs private int subscriptionCounter = 0; private HashMap mHandlerMap = new HashMap<>(); private List pendingHandlerList = new ArrayList<>(); + private boolean printLogs; // State variables private boolean isUnsubscribing; @@ -141,7 +142,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs @Override public void onTextFrame(WebSocket websocket, WebSocketFrame frame) throws Exception { String message = frame.getPayloadText(); - System.out.println("<< "+message); + if(printLogs) System.out.println("<< "+message); if(currentId == LOGIN_ID){ currentId = GET_DATABASE_ID; ArrayList emptyParams = new ArrayList<>(); @@ -316,4 +317,12 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs } } } + + public void setPrintLogs(boolean printLogs){ + this.printLogs = printLogs; + } + + public boolean isPrintLogs(){ + return this.printLogs; + } }