Skip to content

Commit

Permalink
updating format of log
Browse files Browse the repository at this point in the history
  • Loading branch information
wooj-stripe committed Dec 18, 2024
1 parent 9990531 commit 3bfd199
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let JSONKeyObject = "object"
apiClient.urlSession.stp_performDataTask(
with: request as URLRequest,
completionHandler: { body, response, error in
self.parseResponse(response, body: body, error: error, completion: completion)
self.parseResponse(response, method: "POST", body: body, error: error, completion: completion)
}
)
}
Expand Down Expand Up @@ -81,7 +81,7 @@ let JSONKeyObject = "object"
apiClient.urlSession.stp_performDataTask(
with: request as URLRequest,
completionHandler: { body, response, error in
self.parseResponse(response, body: body, error: error, completion: completion)
self.parseResponse(response, method: "GET", body: body, error: error, completion: completion)
}
)
}
Expand Down Expand Up @@ -123,13 +123,14 @@ let JSONKeyObject = "object"
apiClient.urlSession.stp_performDataTask(
with: request as URLRequest,
completionHandler: { body, response, error in
self.parseResponse(response, body: body, error: error, completion: completion)
self.parseResponse(response, method: "DELETE" ,body: body, error: error, completion: completion)
}
)
}

class func parseResponse(
_ response: URLResponse?,
method: String,
body: Data?,
error: Error?,
completion: @escaping (ResponseType?, HTTPURLResponse?, Error?) -> Void
Expand Down Expand Up @@ -190,7 +191,7 @@ let JSONKeyObject = "object"
if let httpResponse,
let requestId = httpResponse.value(forHTTPHeaderField: "request-id"),
let url = httpResponse.value(forKey: "URL") as? URL {
print("[Stripe SDK]: Request \(requestId), \(url.relativePath)")
print("[Stripe SDK]: \(method) \"\(url.relativePath)\" \(httpResponse.statusCode) \(requestId)")
}
#endif

Expand Down

0 comments on commit 3bfd199

Please sign in to comment.