diff options
author | Saturneric <[email protected]> | 2023-02-03 13:43:55 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-02-03 13:43:55 +0000 |
commit | 11d32517c2f6f538209c893c6b0b24572fba1a36 (patch) | |
tree | 0dac14bcad75d9c7c5b5723dc23e6409721966b4 /src/ui/thread/VersionCheckTask.cpp | |
parent | feat: change logging framework to spdlog (diff) | |
download | GpgFrontend-11d32517c2f6f538209c893c6b0b24572fba1a36.tar.gz GpgFrontend-11d32517c2f6f538209c893c6b0b24572fba1a36.zip |
feat: change the log style in source files
Diffstat (limited to 'src/ui/thread/VersionCheckTask.cpp')
-rw-r--r-- | src/ui/thread/VersionCheckTask.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ui/thread/VersionCheckTask.cpp b/src/ui/thread/VersionCheckTask.cpp index 7de3b511..99094891 100644 --- a/src/ui/thread/VersionCheckTask.cpp +++ b/src/ui/thread/VersionCheckTask.cpp @@ -49,7 +49,7 @@ void VersionCheckTask::Run() { try { using namespace nlohmann; - LOG(INFO) << "current version" << current_version_; + SPDLOG_INFO("current version: {}", current_version_); std::string latest_version_url = "https://api.github.com/repos/saturneric/gpgfrontend/releases/latest"; @@ -73,7 +73,7 @@ void VersionCheckTask::slot_parse_latest_version_info() { try { if (latest_reply_ == nullptr || latest_reply_->error() != QNetworkReply::NoError) { - LOG(ERROR) << "latest version request error"; + SPDLOG_ERROR("latest version request error"); version_.latest_version = current_version_; } else { latest_reply_bytes_ = latest_reply_->readAll(); @@ -83,16 +83,16 @@ void VersionCheckTask::slot_parse_latest_version_info() { std::string latest_version = latest_reply_json["tag_name"]; - LOG(INFO) << "latest version from Github" << latest_version; + SPDLOG_INFO("latest version from Github: {}", latest_version); QRegularExpression re(R"(^[vV](\d+\.)?(\d+\.)?(\*|\d+))"); auto version_match = re.match(latest_version.c_str()); if (version_match.hasMatch()) { latest_version = version_match.captured(0).toStdString(); - LOG(INFO) << "latest version matched" << latest_version; + SPDLOG_INFO("latest version matched: {}", latest_version); } else { latest_version = current_version_; - LOG(WARNING) << "latest version unknown"; + SPDLOG_WARN("latest version unknown"); } bool prerelease = latest_reply_json["prerelease"], @@ -106,7 +106,7 @@ void VersionCheckTask::slot_parse_latest_version_info() { version_.release_note = release_note; } } catch (...) { - LOG(INFO) << "error occurred"; + SPDLOG_INFO("error occurred"); version_.load_info_done = false; } @@ -126,7 +126,7 @@ void VersionCheckTask::slot_parse_latest_version_info() { connect(current_reply_, &QNetworkReply::finished, this, &VersionCheckTask::slot_parse_current_version_info); } catch (...) { - LOG(ERROR) << "current version request create error"; + SPDLOG_ERROR("current version request create error"); emit SignalTaskFinished(); } } @@ -135,12 +135,12 @@ void VersionCheckTask::slot_parse_current_version_info() { try { if (current_reply_ == nullptr || current_reply_->error() != QNetworkReply::NoError) { - LOG(ERROR) << "current version request network error"; + SPDLOG_ERROR("current version request network error"); version_.current_version_found = false; } else { version_.current_version_found = true; current_reply_bytes_ = current_reply_->readAll(); - LOG(INFO) << "current version" << current_reply_bytes_.size(); + SPDLOG_INFO("current version: {}", current_reply_bytes_.size()); auto current_reply_json = nlohmann::json::parse(current_reply_bytes_.toStdString()); bool current_prerelease = current_reply_json["prerelease"], @@ -150,11 +150,11 @@ void VersionCheckTask::slot_parse_current_version_info() { version_.load_info_done = true; } } catch (...) { - LOG(INFO) << "error occurred"; + SPDLOG_INFO("error occurred"); version_.load_info_done = false; } - LOG(INFO) << "current version parse done" << version_.current_version_found; + SPDLOG_INFO("current version parse done: {}", version_.current_version_found); if (current_reply_ != nullptr) { current_reply_->deleteLater(); |