From 644aa4397b03dbef73f8bfedc13925b51cad836b Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 5 Jan 2024 20:55:15 +0800 Subject: feat: integrate logging api to core --- src/core/function/gpg/GpgKeyGetter.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/function/gpg/GpgKeyGetter.cpp') diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index de8895d9..5c5ed039 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -43,7 +43,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { public: explicit Impl(int channel) : SingletonFunctionObject(channel) { - SPDLOG_DEBUG("called channel: {}", channel); + GF_CORE_LOG_DEBUG("called channel: {}", channel); } auto GetKey(const std::string& fpr, bool use_cache) -> GpgKey { @@ -56,7 +56,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { gpgme_key_t p_key = nullptr; gpgme_get_key(ctx_.DefaultContext(), fpr.c_str(), &p_key, 1); if (p_key == nullptr) { - SPDLOG_WARN("GpgKeyGetter GetKey Private _p_key Null fpr", fpr); + GF_CORE_LOG_WARN("GpgKeyGetter GetKey Private _p_key Null fpr", fpr); return GetPubkey(fpr, true); } return GpgKey(std::move(p_key)); @@ -71,7 +71,8 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { gpgme_key_t p_key = nullptr; gpgme_get_key(ctx_.DefaultContext(), fpr.c_str(), &p_key, 0); - if (p_key == nullptr) SPDLOG_WARN("GpgKeyGetter GetKey _p_key Null", fpr); + if (p_key == nullptr) + GF_CORE_LOG_WARN("GpgKeyGetter GetKey _p_key Null", fpr); return GpgKey(std::move(p_key)); } @@ -93,7 +94,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { } auto FlushKeyCache() -> bool { - SPDLOG_DEBUG("flush key channel called, channel: {}", GetChannel()); + GF_CORE_LOG_DEBUG("flush key channel called, channel: {}", GetChannel()); // clear the keys cache keys_cache_.clear(); @@ -126,8 +127,9 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { } } - SPDLOG_DEBUG("flush key channel cache address: {} object address: {}", - static_cast(&keys_cache_), static_cast(this)); + GF_CORE_LOG_DEBUG("flush key channel cache address: {} object address: {}", + static_cast(&keys_cache_), + static_cast(this)); // for debug assert(CheckGpgError2ErrCode(err, GPG_ERR_EOF) == GPG_ERR_EOF); @@ -135,7 +137,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { err = gpgme_op_keylist_end(ctx_.DefaultContext()); assert(CheckGpgError2ErrCode(err, GPG_ERR_EOF) == GPG_ERR_NO_ERROR); - SPDLOG_DEBUG("flush key channel done, channel: {}", GetChannel()); + GF_CORE_LOG_DEBUG("flush key channel done, channel: {}", GetChannel()); return true; } @@ -209,7 +211,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { GpgKeyGetter::GpgKeyGetter(int channel) : SingletonFunctionObject(channel), p_(SecureCreateUniqueObject(channel)) { - SPDLOG_DEBUG("called channel: {}", channel); + GF_CORE_LOG_DEBUG("called channel: {}", channel); } GpgKeyGetter::~GpgKeyGetter() = default; -- cgit v1.2.3