From 25da9a9c1b2c923b930f4e238886171df912130e Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Thu, 13 Jul 2023 20:31:32 +0100 Subject: [PATCH] reword comment --- lib/src/main/java/io/ably/lib/http/HttpCore.java | 6 +++--- .../main/java/io/ably/lib/transport/ConnectionManager.java | 2 +- .../main/java/io/ably/lib/transport/WebSocketTransport.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/main/java/io/ably/lib/http/HttpCore.java b/lib/src/main/java/io/ably/lib/http/HttpCore.java index 58154040f..8277fe3d9 100644 --- a/lib/src/main/java/io/ably/lib/http/HttpCore.java +++ b/lib/src/main/java/io/ably/lib/http/HttpCore.java @@ -216,14 +216,14 @@ T httpExecute(HttpURLConnection conn, String method, Param[] headers, Reques byte[] body = null; if(requestBody != null) { body = prepareRequestBody(requestBody, conn); - // Logging level is checked before logging for performance reasons in building the entry + // Check the logging level to avoid performance hit associated with building the message if (Log.level <= Log.VERBOSE) Log.v(TAG, System.lineSeparator() + new String(body)); } /* log raw request details */ Map> requestProperties = conn.getRequestProperties(); - // Logging level is checked before logging for performance reasons in building the entry + // Check the logging level to avoid performance hit associated with building the message if (Log.level <= Log.VERBOSE) { Log.v(TAG, "HTTP request: " + conn.getURL() + " " + method); if (credentialsIncluded) @@ -401,7 +401,7 @@ private Response readResponse(HttpURLConnection connection) throws IOException { for (Map.Entry> entry : caseSensitiveHeaders.entrySet()) { if (entry.getKey() != null) { response.headers.put(entry.getKey().toLowerCase(Locale.ROOT), entry.getValue()); - // Logging level is checked before logging for performance reasons in building the entry + // Check the logging level to avoid performance hit associated with building the message if (Log.level <= Log.VERBOSE) for (String val : entry.getValue()) Log.v(TAG, entry.getKey() + ": " + val); diff --git a/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java b/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java index 7daba7758..29f33706a 100644 --- a/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java +++ b/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java @@ -1136,7 +1136,7 @@ public void onMessage(ITransport transport, ProtocolMessage message) throws Ably if (transport != null && this.transport != transport) { return; } - // Logging level is checked before logging for performance reasons in building the entry + // Check the logging level to avoid performance hit associated with building the message if (Log.level <= Log.VERBOSE) { Log.v(TAG, "onMessage() (transport = " + transport + "): " + message.action + ": " + new String(ProtocolSerializer.writeJSON(message))); } diff --git a/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java b/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java index 14a35983f..ba3399b7e 100644 --- a/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java +++ b/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java @@ -111,14 +111,14 @@ public void send(ProtocolMessage msg) throws AblyException { if(channelBinaryMode) { byte[] encodedMsg = ProtocolSerializer.writeMsgpack(msg); - // Logging level is checked before logging for performance reasons in building the entry + // Check the logging level to avoid performance hit associated with building the message if (Log.level <= Log.VERBOSE) { ProtocolMessage decodedMsg = ProtocolSerializer.readMsgpack(encodedMsg); Log.v(TAG, "send(): " + decodedMsg.action + ": " + new String(ProtocolSerializer.writeJSON(decodedMsg))); } wsConnection.send(encodedMsg); } else { - // Logging level is checked before logging for performance reasons in building the entry + // Check the logging level to avoid performance hit associated with building the message if (Log.level <= Log.VERBOSE) Log.v(TAG, "send(): " + new String(ProtocolSerializer.writeJSON(msg))); wsConnection.send(ProtocolSerializer.writeJSON(msg));