Skip to content

Commit

Permalink
remove noisy logs
Browse files Browse the repository at this point in the history
  • Loading branch information
terhechte committed Jun 29, 2022
1 parent 812716a commit 41eeaa9
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions Sources/SwiftGraphQL/HTTP+WebSockets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public class GraphQLSocket<S: GraphQLEnabledSocket> {
lastConnectionParams = AnyCodable(connectionParams)
let message = Message.connectionInit(connectionParams)
let messageData = try encoder.encode(message)
os_log("Start Connection: %{public}@",
log: OSLog.subscription,
type: .debug,
(String(data: messageData, encoding: .utf8) ?? "Invalid .utf8")
// os_log("Start Connection: %{public}@",
// log: OSLog.subscription,
// type: .debug,
// (String(data: messageData, encoding: .utf8) ?? "Invalid .utf8")
)
state = .started
socket = S.create(with: initParams, errorHandler: errorHandler)
Expand All @@ -86,10 +86,10 @@ public class GraphQLSocket<S: GraphQLEnabledSocket> {
socket?.receiveMessages { [weak self] (message) in
switch message {
case .success(let data):
os_log("Received Data: %{public}@",
log: OSLog.subscription,
type: .debug, (String(data: data, encoding: .utf8) ?? "Invalid .utf8")
)
// os_log("Received Data: %{public}@",
// log: OSLog.subscription,
// type: .debug, (String(data: data, encoding: .utf8) ?? "Invalid .utf8")
// )
guard let message = try? JSONDecoder().decode(Message.self, from: data) else {
os_log("Invalid JSON Payload", log: OSLog.subscription, type: .debug)
return false
Expand Down Expand Up @@ -208,10 +208,10 @@ public class GraphQLSocket<S: GraphQLEnabledSocket> {
let payload = selection.buildPayload(operationName: operationName)
let message = Message.subscribe(payload, id: id)
let messageData = try encoder.encode(message)
os_log("Outgoing Data: %{public}@",
log: OSLog.subscription,
type: .debug, (String(data: messageData, encoding: .utf8) ?? "Invalid .utf8")
)
// os_log("Outgoing Data: %{public}@",
// log: OSLog.subscription,
// type: .debug, (String(data: messageData, encoding: .utf8) ?? "Invalid .utf8")
// )
socket?.send(message: messageData, errorHandler: {
eventHandler(.failure(.subscribeFailed($0)))
})
Expand Down Expand Up @@ -491,9 +491,11 @@ extension NWConnection: GraphQLEnabledSocket {
errorHandler(.subscribeFailed(error))

case .setup:
os_log("Setup State Update", log: OSLog.subscription, type: .debug)
// os_log("Setup State Update", log: OSLog.subscription, type: .debug)
()
case .preparing:
os_log("Preparing State Update", log: OSLog.subscription, type: .debug)
// os_log("Preparing State Update", log: OSLog.subscription, type: .debug)
()
case .cancelled:
os_log("Cancelled State Update", log: OSLog.subscription, type: .debug)
@unknown default:
Expand Down Expand Up @@ -563,12 +565,12 @@ extension URLSessionWebSocketTask: GraphQLEnabledSocket {
}

public func send(message: Data, errorHandler: @escaping (Error) -> Void) {
os_log(
"Send data: %{private}@",
log: OSLog.subscription,
type: .debug,
String(data: message, encoding: .utf8) ?? "Invalid Encoding"
)
// os_log(
// "Send data: %{private}@",
// log: OSLog.subscription,
// type: .debug,
// String(data: message, encoding: .utf8) ?? "Invalid Encoding"
// )
self.send(.data(message), completionHandler: {
if let error = $0 {
errorHandler(error)
Expand Down

0 comments on commit 41eeaa9

Please sign in to comment.