From 72a12eca8374a412c8ed8cd67da93b394afdf0f4 Mon Sep 17 00:00:00 2001 From: Felix Schlegel Date: Tue, 24 May 2022 14:46:26 +0200 Subject: [PATCH] Make Task.logger accessible to delegate implementations outside of Package Motivation: This change was proposed in issue [#389](https://github.com/swift-server/async-http-client/issues/389). Users writing their own `HttpClientResponseDelegate` implementation might want to emit log messages to the `task`'s `logger`. Modifications: Changed the access level of `Task`'s `logger` property from `internal` to `public`. Result: Users can access the `logger` property of a `Task` outside of the `async-http-client`. --- Sources/AsyncHTTPClient/HTTPHandler.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/AsyncHTTPClient/HTTPHandler.swift b/Sources/AsyncHTTPClient/HTTPHandler.swift index ab82d4f91..73f467d09 100644 --- a/Sources/AsyncHTTPClient/HTTPHandler.swift +++ b/Sources/AsyncHTTPClient/HTTPHandler.swift @@ -697,9 +697,10 @@ extension HTTPClient { public final class Task { /// The `EventLoop` the delegate will be executed on. public let eventLoop: EventLoop + /// The `Logger` used by the `Task` for logging. + public let logger: Logger // We are okay to store the logger here because a Task is for only one request. let promise: EventLoopPromise - let logger: Logger // We are okay to store the logger here because a Task is for only one request. var isCancelled: Bool { self.lock.withLock { self._isCancelled }