@@ -10,29 +10,26 @@ open class VerboseLogger: BaseLogger {
10
10
super. init ( )
11
11
}
12
12
13
- /// Logs detailed information about a URLRequest, including headers and body.
14
- ///
15
- /// - Parameter urlRequest: The URLRequest to log.
16
- open override func logRequest( _ urlRequest: URLRequest ) {
17
- let httpMethod = urlRequest. httpMethod ?? " UNKNOWN "
18
- let path = urlRequest. url? . path ?? " UNKNOWN "
13
+ open override func logRequest( _ request: URLRequest ) {
14
+ let httpMethod = request. httpMethod ?? " UNKNOWN "
15
+ let path = request. url? . path ?? " UNKNOWN "
19
16
var logString = " \( httpMethod) \( path) \n "
20
17
21
- if let queryItems = urlRequest . url? . query {
18
+ if let queryItems = request . url? . query {
22
19
logString += " Query: \( queryItems) \n "
23
20
}
24
21
25
- if let host = urlRequest . url? . host {
22
+ if let host = request . url? . host {
26
23
logString += " Host: \( host) \n "
27
24
}
28
25
29
- if let headers = urlRequest . allHTTPHeaderFields {
26
+ if let headers = request . allHTTPHeaderFields {
30
27
for (key, value) in headers {
31
28
logString += " \( key) : \( value) \n "
32
29
}
33
30
}
34
31
35
- if let bodyData = urlRequest . httpBody, let bodyString = bodyData. toJSONString ( prettyPrinted: prettyPrinted) {
32
+ if let bodyData = request . httpBody, let bodyString = bodyData. toJSONString ( prettyPrinted: prettyPrinted) {
36
33
logString += " \n \( bodyString) "
37
34
}
38
35
@@ -43,12 +40,7 @@ open class VerboseLogger: BaseLogger {
43
40
log. log ( logString)
44
41
}
45
42
46
- /// Logs detailed information about a URLResponse, including status code, headers, and body.
47
- ///
48
- /// - Parameters:
49
- /// - response: The URLResponse to log.
50
- /// - data: The data associated with the response, if any.
51
- open override func logResponse( _ response: URLResponse ? , data: Data ? ) {
43
+ open override func logResponse( forRequest request: URLRequest ? , response: URLResponse ? , data: Data ? ) {
52
44
var logString = " "
53
45
54
46
if let httpResponse = response as? HTTPURLResponse {
0 commit comments