Skip to content

Commit 3f27623

Browse files
committed
Log task cancellation as error.
1 parent 1c76e8d commit 3f27623

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Sources/ComposableArchitecturePattern/Server.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public extension Server {
8787
let requestUID = UUID()
8888
self.requestsBeingProcessed.insert(requestUID)
8989
if self.logActivity == .all {
90-
logger.info("\(Date()) - (\(requestUID)) Processing GET Request")
90+
logger.info("\(Date()) [GET] - (\(requestUID)) Processing GET Request")
9191
}
9292

9393
do {
9494
try Task.checkCancellation()
9595
} catch {
96-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
96+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
9797
throw ServerAPIError.taskCancelled(error: error)
9898
}
9999

@@ -103,7 +103,7 @@ public extension Server {
103103
do {
104104
try Task.checkCancellation()
105105
} catch {
106-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
106+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
107107
throw ServerAPIError.taskCancelled(error: error)
108108
}
109109

@@ -126,7 +126,7 @@ public extension Server {
126126
do {
127127
try Task.checkCancellation()
128128
} catch {
129-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
129+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
130130
throw ServerAPIError.taskCancelled(error: error)
131131
}
132132

@@ -136,7 +136,7 @@ public extension Server {
136136
do {
137137
try Task.checkCancellation()
138138
} catch {
139-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
139+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
140140
throw ServerAPIError.taskCancelled(error: error)
141141
}
142142

@@ -156,7 +156,7 @@ public extension Server {
156156
do {
157157
try Task.checkCancellation()
158158
} catch {
159-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
159+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
160160
throw ServerAPIError.taskCancelled(error: error)
161161
}
162162

@@ -166,7 +166,7 @@ public extension Server {
166166
do {
167167
try Task.checkCancellation()
168168
} catch {
169-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
169+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
170170
throw ServerAPIError.taskCancelled(error: error)
171171
}
172172

@@ -190,7 +190,7 @@ public extension Server {
190190
do {
191191
try Task.checkCancellation()
192192
} catch {
193-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
193+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
194194
throw ServerAPIError.taskCancelled(error: error)
195195
}
196196

@@ -200,7 +200,7 @@ public extension Server {
200200
do {
201201
try Task.checkCancellation()
202202
} catch {
203-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
203+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
204204
throw ServerAPIError.taskCancelled(error: error)
205205
}
206206

@@ -221,7 +221,7 @@ public extension Server {
221221
do {
222222
try Task.checkCancellation()
223223
} catch {
224-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
224+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
225225
throw ServerAPIError.taskCancelled(error: error)
226226
}
227227

@@ -231,7 +231,7 @@ public extension Server {
231231
do {
232232
try Task.checkCancellation()
233233
} catch {
234-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
234+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
235235
throw ServerAPIError.taskCancelled(error: error)
236236
}
237237

@@ -254,7 +254,7 @@ public extension Server {
254254
do {
255255
try Task.checkCancellation()
256256
} catch {
257-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
257+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
258258
throw ServerAPIError.taskCancelled(error: error)
259259
}
260260

@@ -264,7 +264,7 @@ public extension Server {
264264
do {
265265
try Task.checkCancellation()
266266
} catch {
267-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
267+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
268268
throw ServerAPIError.taskCancelled(error: error)
269269
}
270270

@@ -284,7 +284,7 @@ public extension Server {
284284
do {
285285
try Task.checkCancellation()
286286
} catch {
287-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
287+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: api.path)) [Cancelled]")
288288
throw ServerAPIError.taskCancelled(error: error)
289289
}
290290

@@ -294,7 +294,7 @@ public extension Server {
294294
do {
295295
try Task.checkCancellation()
296296
} catch {
297-
self.logger.info("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
297+
self.logger.error("\(Date()) - (\(requestUID)) Request to \(String(describing: request.url?.description)) [Cancelled]")
298298
throw ServerAPIError.taskCancelled(error: error)
299299
}
300300

0 commit comments

Comments
 (0)