aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/jupiter.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-15 11:27:48 +0200
committerStefan Boberg <[email protected]>2021-09-15 11:27:48 +0200
commit2b9bed6635d95e15847c4d9b602e34d90e277d14 (patch)
tree66fb191150ccbf9f56315a716abd23b25cc1d401 /zenserver/upstream/jupiter.cpp
parentxmake: added zenhttp dependency to make zen CLI tool buld (diff)
downloadzen-2b9bed6635d95e15847c4d9b602e34d90e277d14.tar.xz
zen-2b9bed6635d95e15847c4d9b602e34d90e277d14.zip
Changed logging implementation
* Code should no longer directly `#include spdlog/spdlog.h`, instead use `#include <zencore/logging.h>` * Instead of explicit calls to `spdlog::info(...)` and such please use the logging macros defined in `zencore/logging.h`. I.e `ZEN_INFO`, `ZEN_DEBUG`, `ZEN_TRACE`, `ZEN_ERROR`, `ZEN_CRITITCAL` * The macros will pick up the "most local" logger via a `Log()` call to retrieve a logger instance. To override the default logger in a class please implement your own `Log()` function
Diffstat (limited to 'zenserver/upstream/jupiter.cpp')
-rw-r--r--zenserver/upstream/jupiter.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/zenserver/upstream/jupiter.cpp b/zenserver/upstream/jupiter.cpp
index ba6300c65..29fee1d32 100644
--- a/zenserver/upstream/jupiter.cpp
+++ b/zenserver/upstream/jupiter.cpp
@@ -80,7 +80,7 @@ CloudCacheSession::GetDerivedData(std::string_view BucketId, std::string_view Ke
Session.SetOption(cpr::Header{{"Authorization", Auth}});
cpr::Response Response = Session.Get();
- m_Log.debug("GET {}", Response);
+ ZEN_DEBUG("GET {}", Response);
const bool Success = Response.status_code == 200;
const IoBuffer Buffer = Success ? IoBufferBuilder::MakeCloneFromMemory(Response.text.data(), Response.text.size()) : IoBuffer();
@@ -111,7 +111,7 @@ CloudCacheSession::GetRef(std::string_view BucketId, const IoHash& Key, ZenConte
Session.SetOption(cpr::Header{{"Authorization", Auth}, {"Accept", ContentType}});
cpr::Response Response = Session.Get();
- m_Log.debug("GET {}", Response);
+ ZEN_DEBUG("GET {}", Response);
const bool Success = Response.status_code == 200;
const IoBuffer Buffer = Success ? IoBufferBuilder::MakeCloneFromMemory(Response.text.data(), Response.text.size()) : IoBuffer();
@@ -134,7 +134,7 @@ CloudCacheSession::GetCompressedBlob(const IoHash& Key)
Session.SetOption(cpr::Header{{"Authorization", Auth}, {"Accept", "application/x-ue-comp"}});
cpr::Response Response = Session.Get();
- m_Log.debug("GET {}", Response);
+ ZEN_DEBUG("GET {}", Response);
const bool Success = Response.status_code == 200;
const IoBuffer Buffer = Success ? IoBufferBuilder::MakeCloneFromMemory(Response.text.data(), Response.text.size()) : IoBuffer();
@@ -161,7 +161,7 @@ CloudCacheSession::PutDerivedData(std::string_view BucketId, std::string_view Ke
Session.SetBody(cpr::Body{(const char*)DerivedData.Data(), DerivedData.Size()});
cpr::Response Response = Session.Put();
- m_Log.debug("PUT {}", Response);
+ ZEN_DEBUG("PUT {}", Response);
return {.Bytes = Response.uploaded_bytes, .ElapsedSeconds = Response.elapsed, .Success = Response.status_code == 200};
}
@@ -192,7 +192,7 @@ CloudCacheSession::PutRef(std::string_view BucketId, const IoHash& Key, IoBuffer
Session.SetBody(cpr::Body{(const char*)Ref.Data(), Ref.Size()});
cpr::Response Response = Session.Put();
- m_Log.debug("PUT {}", Response);
+ ZEN_DEBUG("PUT {}", Response);
return {.Bytes = Response.uploaded_bytes, .ElapsedSeconds = Response.elapsed, .Success = Response.status_code == 200};
}
@@ -213,7 +213,7 @@ CloudCacheSession::PutCompressedBlob(const IoHash& Key, IoBuffer Blob)
Session.SetBody(cpr::Body{(const char*)Blob.Data(), Blob.Size()});
cpr::Response Response = Session.Put();
- m_Log.debug("PUT {}", Response);
+ ZEN_DEBUG("PUT {}", Response);
return {.Bytes = Response.uploaded_bytes, .ElapsedSeconds = Response.elapsed, .Success = Response.status_code == 200};
}
@@ -268,7 +268,7 @@ CloudCacheClient::CloudCacheClient(const CloudCacheClientOptions& Options)
{
if (!Options.OAuthProvider.starts_with("http://"sv) && !Options.OAuthProvider.starts_with("https://"sv))
{
- m_Log.warn("bad provider specification: '{}' - must be fully qualified"_format(Options.OAuthProvider).c_str());
+ ZEN_WARN("bad provider specification: '{}' - must be fully qualified"_format(Options.OAuthProvider).c_str());
m_IsValid = false;
return;
@@ -280,7 +280,7 @@ CloudCacheClient::CloudCacheClient(const CloudCacheClientOptions& Options)
if (SchemePos == std::string::npos)
{
- m_Log.warn("Bad service URL passed to cloud cache client: '{}'", Options.ServiceUrl);
+ ZEN_WARN("Bad service URL passed to cloud cache client: '{}'", Options.ServiceUrl);
m_IsValid = false;
return;
@@ -290,7 +290,7 @@ CloudCacheClient::CloudCacheClient(const CloudCacheClientOptions& Options)
if (DomainEnd == std::string::npos)
{
- m_Log.warn("Bad service URL passed to cloud cache client: '{}' no path delimiter found", Options.ServiceUrl);
+ ZEN_WARN("Bad service URL passed to cloud cache client: '{}' no path delimiter found", Options.ServiceUrl);
m_IsValid = false;
return;
@@ -347,7 +347,7 @@ CloudCacheClient::AcquireAccessToken(std::string& AuthorizationHeaderValue)
json11::Json JsonResponse = json11::Json::parse(Body, /* out */ JsonError);
if (!JsonError.empty())
{
- spdlog::warn("failed to parse OAuth response: '{}'", JsonError);
+ ZEN_WARN("failed to parse OAuth response: '{}'", JsonError);
return false;
}