From 380529fb1028ff22dc8da843223d66a9e90a26f7 Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Mon, 11 Sep 2023 16:50:48 +0100 Subject: [PATCH] add logs --- src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt b/src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt index 26802ec..f881673 100644 --- a/src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt +++ b/src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt @@ -314,6 +314,7 @@ public class PoWebClient internal constructor( headers?.forEach { header(it.first, it.second) } } repeat(Int.MAX_VALUE) { + logger.info { "Starting WebSocket connection attempt #$it" } try { return ktorClient.webSocket(url, request, block) } catch (exc: EOFException) { @@ -322,7 +323,10 @@ public class PoWebClient internal constructor( logger.info { "WebSocket connection ended abruptly (${exc.message}). Will retry." } delay(ABRUPT_DISCONNECT_RETRY_DELAY) } catch (exc: IOException) { + logger.info { "Server is unreachable (${exc.message})" } throw ServerConnectionException("Server is unreachable", exc) + } finally { + logger.info { "WebSocket connection attempt #$it ended" } } } }