From 5efd2714393aa9272065819b2855c378ab5a91c1 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 4 Oct 2023 23:45:56 +0200 Subject: [PATCH] Only log operationMessage in case gql logging is enabled --- .../ApolloSubscriptionProtocolHandler.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt index fcccac791..c1876907b 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/server/subscriptions/ApolloSubscriptionProtocolHandler.kt @@ -35,6 +35,7 @@ import suwayomi.tachidesk.graphql.server.subscriptions.SubscriptionOperationMess import suwayomi.tachidesk.graphql.server.subscriptions.SubscriptionOperationMessage.ServerMessages.GQL_ERROR import suwayomi.tachidesk.graphql.server.subscriptions.SubscriptionOperationMessage.ServerMessages.GQL_NEXT import suwayomi.tachidesk.graphql.server.toGraphQLContext +import suwayomi.tachidesk.server.serverConfig /** * Implementation of the `graphql-ws` protocol defined by Apollo @@ -54,7 +55,15 @@ class ApolloSubscriptionProtocolHandler( fun handleMessage(context: WsMessageContext): Flow { val operationMessage = convertToMessageOrNull(context.message()) ?: return flowOf(basicConnectionErrorMessage) - logger.debug { "GraphQL subscription client message, sessionId=${context.sessionId} operationMessage=$operationMessage" } + logger.debug { + "GraphQL subscription client message, sessionId=${context.sessionId} ${ + if (serverConfig.gqlDebugLogsEnabled.value) { + "operationMessage=$operationMessage" + } else { + "" + } + }" + } return try { when (operationMessage.type) {