File tree Expand file tree Collapse file tree 2 files changed +40
-7
lines changed Expand file tree Collapse file tree 2 files changed +40
-7
lines changed Original file line number Diff line number Diff line change @@ -120,3 +120,26 @@ extension NotificationType {
120
120
return AnyNotificationType ( notification: self ) . forLogging
121
121
}
122
122
}
123
+
124
+ fileprivate struct AnyResponseType : CustomLogStringConvertible {
125
+ let response : any ResponseType
126
+
127
+ var description : String {
128
+ return """
129
+ \( type ( of: response) )
130
+ \( response. prettyPrintJSON)
131
+ """
132
+ }
133
+
134
+ var redactedDescription : String {
135
+ return """
136
+ \( type ( of: response) )
137
+ """
138
+ }
139
+ }
140
+
141
+ extension ResponseType {
142
+ public var forLogging : CustomLogStringConvertibleWrapper {
143
+ return AnyResponseType ( response: self ) . forLogging
144
+ }
145
+ }
Original file line number Diff line number Diff line change @@ -711,14 +711,24 @@ extension SourceKitServer: MessageHandler {
711
711
reply ( result)
712
712
let endDate = Date ( )
713
713
Task {
714
- logger. debug (
715
- """
716
- Sending response (took \( endDate. timeIntervalSince ( startDate) * 1000 , privacy: . public) ms)
717
- Response< \( R . method, privacy: . public) ( \( id, privacy: . public) )>(
718
- \( String ( describing: result) )
714
+ switch result {
715
+ case . success( let response) :
716
+ logger. log (
717
+ """
718
+ Succeeded (took \( endDate. timeIntervalSince ( startDate) * 1000 , privacy: . public) ms)
719
+ \( R . method, privacy: . public)
720
+ \( response. forLogging)
721
+ """
719
722
)
720
- """
721
- )
723
+ case . failure( let error) :
724
+ logger. log (
725
+ """
726
+ Failed (took \( endDate. timeIntervalSince ( startDate) * 1000 , privacy: . public) ms)
727
+ \( R . method, privacy: . public) ( \( id, privacy: . public) )
728
+ \( error. forLogging, privacy: . private)
729
+ """
730
+ )
731
+ }
722
732
}
723
733
}
724
734
)
You can’t perform that action at this time.
0 commit comments