UICommon: Migrate logging over to fmt

A very simple change that continues the migration of the logs over to
fmt.
This commit is contained in:
Lioncash 2020-11-09 02:35:49 -05:00
parent a9ef7e0e43
commit 52f2fadb36

View file

@ -164,24 +164,24 @@ void AutoUpdateChecker::CheckForUpdate()
auto resp = req.Get(url); auto resp = req.Get(url);
if (!resp) if (!resp)
{ {
ERROR_LOG(COMMON, "Auto-update request failed"); ERROR_LOG_FMT(COMMON, "Auto-update request failed");
return; return;
} }
std::string contents(reinterpret_cast<char*>(resp->data()), resp->size()); const std::string contents(reinterpret_cast<char*>(resp->data()), resp->size());
INFO_LOG(COMMON, "Auto-update JSON response: %s", contents.c_str()); INFO_LOG_FMT(COMMON, "Auto-update JSON response: {}", contents);
picojson::value json; picojson::value json;
std::string err = picojson::parse(json, contents); const std::string err = picojson::parse(json, contents);
if (!err.empty()) if (!err.empty())
{ {
ERROR_LOG(COMMON, "Invalid JSON received from auto-update service: %s", err.c_str()); ERROR_LOG_FMT(COMMON, "Invalid JSON received from auto-update service: {}", err);
return; return;
} }
picojson::object obj = json.get<picojson::object>(); picojson::object obj = json.get<picojson::object>();
if (obj["status"].get<std::string>() != "outdated") if (obj["status"].get<std::string>() != "outdated")
{ {
INFO_LOG(COMMON, "Auto-update status: we are up to date."); INFO_LOG_FMT(COMMON, "Auto-update status: we are up to date.");
return; return;
} }
@ -229,9 +229,8 @@ void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInforma
#endif #endif
// Run the updater! // Run the updater!
std::string command_line = MakeUpdaterCommandLine(updater_flags); const std::string command_line = MakeUpdaterCommandLine(updater_flags);
INFO_LOG_FMT(COMMON, "Updater command line: {}", command_line);
INFO_LOG(COMMON, "Updater command line: %s", command_line.c_str());
#ifdef _WIN32 #ifdef _WIN32
STARTUPINFO sinfo = {sizeof(sinfo)}; STARTUPINFO sinfo = {sizeof(sinfo)};
@ -245,12 +244,12 @@ void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInforma
} }
else else
{ {
ERROR_LOG(COMMON, "Could not start updater process: error=%d", GetLastError()); ERROR_LOG_FMT(COMMON, "Could not start updater process: error={}", GetLastError());
} }
#else #else
if (popen(command_line.c_str(), "r") == nullptr) if (popen(command_line.c_str(), "r") == nullptr)
{ {
ERROR_LOG(COMMON, "Could not start updater process: error=%d", errno); ERROR_LOG_FMT(COMMON, "Could not start updater process: error={}", errno);
} }
#endif #endif