Skip to content

Commit

Permalink
Only log operationMessage in case gql logging is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda committed Oct 4, 2023
1 parent 354968f commit 5efd271
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -54,7 +55,15 @@ class ApolloSubscriptionProtocolHandler(

fun handleMessage(context: WsMessageContext): Flow<SubscriptionOperationMessage> {
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) {
Expand Down

0 comments on commit 5efd271

Please sign in to comment.