diff options
Diffstat (limited to 'src/zenhttp/httpclient.cpp')
| -rw-r--r-- | src/zenhttp/httpclient.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/zenhttp/httpclient.cpp b/src/zenhttp/httpclient.cpp index f3a9ad71b..b77b31933 100644 --- a/src/zenhttp/httpclient.cpp +++ b/src/zenhttp/httpclient.cpp @@ -121,7 +121,7 @@ CommonResponse(cpr::Response&& HttpResponse, IoBuffer&& Payload = {}) struct HttpClient::Impl : public RefCounted { - Impl(); + Impl(spdlog::logger& Log); ~Impl(); // Session allocation @@ -169,6 +169,8 @@ struct HttpClient::Impl : public RefCounted return Result; } + spdlog::logger& Logger() { return Outer->Logger(); } + private: Impl* Outer; cpr::Session* CprSession; @@ -183,14 +185,17 @@ struct HttpClient::Impl : public RefCounted const KeyValueMap& AdditionalHeader, const KeyValueMap& Parameters); + spdlog::logger& Logger() { return m_Log; } + private: + spdlog::logger& m_Log; RwLock m_SessionLock; std::vector<cpr::Session*> m_Sessions; void ReleaseSession(cpr::Session*); }; -HttpClient::Impl::Impl() +HttpClient::Impl::Impl(spdlog::logger& Log) : m_Log(Log) { } @@ -420,9 +425,10 @@ private: ////////////////////////////////////////////////////////////////////////// HttpClient::HttpClient(std::string_view BaseUri, const HttpClientSettings& Connectionsettings) -: m_BaseUri(BaseUri) +: m_Log(zen::logging::Get(Connectionsettings.LogCategory)) +, m_BaseUri(BaseUri) , m_ConnectionSettings(Connectionsettings) -, m_Impl(new Impl) +, m_Impl(new Impl(m_Log)) { StringBuilder<32> SessionId; GetSessionId().ToString(SessionId); |