diff options
| author | Dan Engelbrecht <[email protected]> | 2023-09-08 09:47:35 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-08 15:47:35 +0200 |
| commit | f2aab0df9fc96162e603eaa50922369de81a0447 (patch) | |
| tree | c5759c21832537b02838951566f9cbda4f6b99b2 /src/zenhttp/httpclient.cpp | |
| parent | multithread file realization in oplog-mirror (#388) (diff) | |
| download | zen-f2aab0df9fc96162e603eaa50922369de81a0447.tar.xz zen-f2aab0df9fc96162e603eaa50922369de81a0447.zip | |
add console logging to zen command (#389)
properly set trace log level if IsVerbose
add log category to http client
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); |