aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/gpg/GpgKeyGetter.cpp
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2023-02-25 11:49:54 +0000
committerGitHub <[email protected]>2023-02-25 11:49:54 +0000
commitaf1cd680f2496629026ba27707cef2afd860f5f9 (patch)
tree78e78450893e98b8828cc41010e377c1561e5f34 /src/core/function/gpg/GpgKeyGetter.cpp
parentfix: improve manual (diff)
parentfeat: use aqt to install qt in ci build (diff)
downloadGpgFrontend-af1cd680f2496629026ba27707cef2afd860f5f9.tar.gz
GpgFrontend-af1cd680f2496629026ba27707cef2afd860f5f9.zip
Merge pull request #91 from saturneric/dev/2.0.10/main
Develop 2.1.0.1
Diffstat (limited to 'src/core/function/gpg/GpgKeyGetter.cpp')
-rw-r--r--src/core/function/gpg/GpgKeyGetter.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp
index 571e8797..a8e685e0 100644
--- a/src/core/function/gpg/GpgKeyGetter.cpp
+++ b/src/core/function/gpg/GpgKeyGetter.cpp
@@ -35,19 +35,15 @@
#include <utility>
#include "GpgConstants.h"
-#include "easylogging++.h"
#include "model/GpgKey.h"
GpgFrontend::GpgKeyGetter::GpgKeyGetter(int channel)
: SingletonFunctionObject<GpgKeyGetter>(channel) {
- LOG(INFO) << "called"
- << "channel:" << channel;
+ SPDLOG_DEBUG("called channel: {}", channel);
}
GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetKey(const std::string& fpr,
bool use_cache) {
- LOG(INFO) << "called";
-
// find in cache first
if (use_cache) {
auto key = get_key_in_cache(fpr);
@@ -57,7 +53,7 @@ GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetKey(const std::string& fpr,
gpgme_key_t _p_key = nullptr;
gpgme_get_key(ctx_, fpr.c_str(), &_p_key, 1);
if (_p_key == nullptr) {
- DLOG(WARNING) << "GpgKeyGetter GetKey Private _p_key Null fpr" << fpr;
+ SPDLOG_WARN("GpgKeyGetter GetKey Private _p_key Null fpr", fpr);
return GetPubkey(fpr);
} else {
return GpgKey(std::move(_p_key));
@@ -74,8 +70,7 @@ GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetPubkey(const std::string& fpr,
gpgme_key_t _p_key = nullptr;
gpgme_get_key(ctx_, fpr.c_str(), &_p_key, 0);
- if (_p_key == nullptr)
- DLOG(WARNING) << "GpgKeyGetter GetKey _p_key Null" << fpr;
+ if (_p_key == nullptr) SPDLOG_WARN("GpgKeyGetter GetKey _p_key Null", fpr);
return GpgKey(std::move(_p_key));
}
@@ -83,21 +78,19 @@ GpgFrontend::KeyLinkListPtr GpgFrontend::GpgKeyGetter::FetchKey() {
// get the lock
std::lock_guard<std::mutex> lock(keys_cache_mutex_);
- LOG(INFO) << "GpgKeyGetter FetchKey"
- << "channel id:" << GetChannel();
+ SPDLOG_DEBUG("channel id: {}", GetChannel());
auto keys_list = std::make_unique<GpgKeyLinkList>();
for (const auto& [key, value] : keys_cache_) {
- LOG(INFO) << "FetchKey Id:" << value.GetId();
+ SPDLOG_DEBUG("fetch key id: {}", value.GetId());
keys_list->push_back(value.Copy());
}
return keys_list;
}
void GpgFrontend::GpgKeyGetter::FlushKeyCache() {
- LOG(INFO) << "called"
- << "channel id: " << GetChannel();
+ SPDLOG_DEBUG("called channel id: {}", GetChannel());
// clear the keys cache
keys_cache_.clear();
@@ -125,13 +118,14 @@ void GpgFrontend::GpgKeyGetter::FlushKeyCache() {
gpg_key = GetKey(gpg_key.GetId(), false);
}
- LOG(INFO) << "LoadKey Fpr:" << gpg_key.GetFingerprint()
- << "Id:" << gpg_key.GetId();
+ SPDLOG_DEBUG("load key fpr: {} id: {}", gpg_key.GetFingerprint(),
+ gpg_key.GetId());
keys_cache_.insert({gpg_key.GetId(), std::move(gpg_key)});
}
}
- LOG(INFO) << "cache address:" << &keys_cache_ << "object address" << this;
+ SPDLOG_DEBUG("cache address: {} object address: {}",
+ static_cast<void*>(&keys_cache_), static_cast<void*>(this));
// for debug
assert(check_gpg_error_2_err_code(err, GPG_ERR_EOF) == GPG_ERR_EOF);