Migrate force_log_printf to new logging (#714)

This commit is contained in:
why-keith 2023-04-12 15:31:34 +01:00 committed by GitHub
parent 072c18a6e3
commit 4be57f4896
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 401 additions and 399 deletions

View file

@ -130,7 +130,7 @@ bool CemuUpdateWindow::QueryUpdateInfo(std::string& downloadUrlOut, std::string&
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
if (http_code != 0 && http_code != 200)
{
forceLog_printf("Update check failed (http code: %d)", http_code);
cemuLog_log(LogType::Force, "Update check failed (http code: {})", http_code);
cemu_assert_debug(false);
return false;
}
@ -154,7 +154,7 @@ bool CemuUpdateWindow::QueryUpdateInfo(std::string& downloadUrlOut, std::string&
}
else
{
forceLog_printf("Update check failed with CURL error %d", (int)cr);
cemuLog_log(LogType::Force, "Update check failed with CURL error {}", (int)cr);
cemu_assert_debug(false);
}
@ -261,7 +261,7 @@ bool CemuUpdateWindow::DownloadCemuZip(const std::string& url, const fs::path& f
}
catch (const std::exception& ex)
{
forceLog_printf("can't remove update.zip on error: %s", ex.what());
cemuLog_log(LogType::Force, "can't remove update.zip on error: {}", ex.what());
}
}
return result;
@ -309,13 +309,13 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta
catch (const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf("can't create folder \"%s\" for update: %s", sb.name, sys.what());
cemuLog_log(LogType::Force, "can't create folder \"{}\" for update: {}", sb.name, sys.what());
}
// the root should have only one Cemu_... directory, we track it here
if ((std::count(sb.name, sb.name + len, '/') + std::count(sb.name, sb.name + len, '\\')) == 1)
{
if (!cemuFolderName.empty())
forceLog_printf("update zip has multiple folders in root");
cemuLog_log(LogType::Force, "update zip has multiple folders in root");
cemuFolderName.assign(sb.name, len - 1);
}
continue;
@ -325,7 +325,7 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta
auto* zf = zip_fopen_index(za, i, 0);
if (!zf)
{
forceLog_printf("can't open zip file \"%s\"", sb.name);
cemuLog_log(LogType::Force, "can't open zip file \"{}\"", sb.name);
zip_close(za);
return false;
}
@ -334,7 +334,7 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta
const auto read = zip_fread(zf, buffer.data(), sb.size);
if (read != (sint64)sb.size)
{
forceLog_printf("could only read 0x%x of 0x%x bytes from zip file \"%s\"", read, sb.size, sb.name);
cemuLog_log(LogType::Force, "could only read 0x{:x} of 0x{:x} bytes from zip file \"{}\"", read, sb.size, sb.name);
zip_close(za);
return false;
}
@ -342,7 +342,7 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta
auto* file = fopen(fname.string().c_str(), "wb");
if (file == nullptr)
{
forceLog_printf("can't create update file \"%s\"", sb.name);
cemuLog_log(LogType::Force, "can't create update file \"{}\"", sb.name);
zip_close(za);
return false;
}
@ -460,7 +460,7 @@ void CemuUpdateWindow::WorkerThread()
catch (const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf("can't remove extracted tmp files: %s", sys.what());
cemuLog_log(LogType::Force, "can't remove extracted tmp files: {}", sys.what());
}
}
@ -506,7 +506,7 @@ void CemuUpdateWindow::WorkerThread()
catch (const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf("applying update error: %s", sys.what());
cemuLog_log(LogType::Force, "applying update error: {}", sys.what());
}
if ((counter++ % 10) == 0)
@ -529,7 +529,7 @@ void CemuUpdateWindow::WorkerThread()
catch (const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf("update error: %s", sys.what());
cemuLog_log(LogType::Force, "update error: {}", sys.what());
// clean leftovers
if (exists(tmppath))

View file

@ -335,7 +335,7 @@ void ChecksumTool::LoadOnlineData() const
}
catch(const std::exception& ex)
{
forceLog_printf("error on updating json checksum data: %s", ex.what());
cemuLog_log(LogType::Force, "error on updating json checksum data: {}", ex.what());
}
wxQueueEvent(m_verify_online, new wxCommandEvent(wxEVT_ENABLE));
@ -778,4 +778,4 @@ void ChecksumTool::DoWork()
wxQueueEvent(this, new wxSetGaugeValue(100, m_progress, m_status, wxStringFormat2(_("Generated checksum of {} game files"), file_count)));
break;
}
}
}

View file

@ -136,7 +136,7 @@ void DownloadGraphicPacksWindow::UpdateThread()
else
{
// cemu api request failed, use hardcoded github url
forceLog_printf("Graphic pack update request failed or returned invalid URL. Using default repository URL instead");
cemuLog_log(LogType::Force, "Graphic pack update request failed or returned invalid URL. Using default repository URL instead");
githubAPIUrl = "https://api.github.com/repos/slashiee/cemu_graphic_packs/releases/latest";
}
// github API request

View file

@ -105,7 +105,7 @@ bool GameUpdateWindow::ParseUpdate(const fs::path& metaPath)
}
catch (const std::exception& ex)
{
forceLog_printf("GameUpdateWindow::ParseUpdate exist-error: %s at %s", ex.what(), target_location.generic_u8string().c_str());
cemuLog_log(LogType::Force, "GameUpdateWindow::ParseUpdate exist-error: {} at {}", ex.what(), _pathToUtf8(target_location));
}
}

View file

@ -1276,7 +1276,7 @@ void GeneralSettings2::OnAccountDelete(wxCommandEvent& event)
catch(const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf((char*)sys.what());
cemuLog_log(LogType::Force, sys.what());
}
}
@ -1743,7 +1743,7 @@ void GeneralSettings2::UpdateAudioDevice()
}
catch (std::runtime_error& ex)
{
forceLog_printf("can't initialize tv audio: %s", ex.what());
cemuLog_log(LogType::Force, "can't initialize tv audio: {}", ex.what());
}
}
}
@ -1792,7 +1792,7 @@ void GeneralSettings2::UpdateAudioDevice()
}
catch (std::runtime_error& ex)
{
forceLog_printf("can't initialize pad audio: %s", ex.what());
cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what());
}
}
}
@ -1840,7 +1840,7 @@ void GeneralSettings2::UpdateAudioDevice()
}
catch (std::runtime_error& ex)
{
forceLog_printf("can't initialize pad audio: %s", ex.what());
cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what());
}
}
}

View file

@ -1035,7 +1035,7 @@ void MainWindow::OnDebugSetting(wxCommandEvent& event)
catch (const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf("error when creating dump curl folder: %s", sys.what());
cemuLog_log(LogType::Force, "error when creating dump curl folder: {}", sys.what());
ActiveSettings::EnableDumpLibcurlRequests(false);
}
}
@ -1092,7 +1092,7 @@ void MainWindow::OnDebugDumpUsedTextures(wxCommandEvent& event)
catch (const std::exception& ex)
{
SystemException sys(ex);
forceLog_printf("can't create texture dump folder: %s", ex.what());
cemuLog_log(LogType::Force, "can't create texture dump folder: {}", ex.what());
ActiveSettings::EnableDumpTextures(false);
}
}
@ -1113,7 +1113,7 @@ void MainWindow::OnDebugDumpUsedShaders(wxCommandEvent& event)
catch (const std::exception & ex)
{
SystemException sys(ex);
forceLog_printf("can't create shaders dump folder: %s", ex.what());
cemuLog_log(LogType::Force, "can't create shaders dump folder: {}", ex.what());
ActiveSettings::EnableDumpShaders(false);
}
}

View file

@ -535,7 +535,7 @@ void TitleManager::OnSaveDelete(wxCommandEvent& event)
}
if (!meta_file_edited)
forceLog_printf("TitleManager::OnSaveDelete: couldn't delete save entry in saveinfo.xml: %s", saveinfo.generic_u8string().c_str());
cemuLog_log(LogType::Force, "TitleManager::OnSaveDelete: couldn't delete save entry in saveinfo.xml: {}", _pathToUtf8(saveinfo));
// remove from title entry
auto& persistent_ids = entry->persistent_ids;

View file

@ -37,7 +37,7 @@ VulkanCanvas::VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_wi
catch(const std::exception& ex)
{
const auto msg = fmt::format(fmt::runtime(_("Error when initializing Vulkan renderer:\n{}").ToStdString()), ex.what());
forceLog_printf(const_cast<char*>(msg.c_str()));
cemuLog_log(LogType::Force, msg);
wxMessageDialog dialog(this, msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
dialog.ShowModal();
exit(0);

View file

@ -875,7 +875,7 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event)
}
catch (const std::exception& ex)
{
forceLog_printf("wxTitleManagerList::OnContextMenuSelected: can't launch title: %s", ex.what());
cemuLog_log(LogType::Force, "wxTitleManagerList::OnContextMenuSelected: can't launch title: {}", ex.what());
}
}
break;

View file

@ -232,7 +232,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event)
zip_stat_t sb{};
if (zip_stat_index(zip, i, 0, &sb) != 0)
{
forceLog_printf("zip stat index failed on %d entry", i);
cemuLog_log(LogType::Force, "zip stat index failed on {} entry", i);
continue;
}
@ -251,7 +251,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event)
{
fs::create_directories(path, ec);
if (ec)
forceLog_printf("can't create directory %s: %s", sb.name, ec.message().c_str());
cemuLog_log(LogType::Force, "can't create directory {}: {}", sb.name, ec.message());
continue;
}
@ -307,7 +307,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event)
timestamp.text().set(fmt::format("{:016x}", coreinit::coreinit_getOSTime() / ESPRESSO_TIMER_CLOCK).c_str()); // TODO time not initialized yet?
if(!doc.save_file(saveinfo.c_str()))
forceLog_printf("couldn't insert save entry in saveinfo.xml: %s", saveinfo.generic_u8string().c_str());
cemuLog_log(LogType::Force, "couldn't insert save entry in saveinfo.xml: {}", _pathToUtf8(saveinfo));
}
}
}

View file

@ -181,7 +181,7 @@ void SaveTransfer::OnTransfer(wxCommandEvent& event)
}
if (!meta_file_edited)
forceLog_printf("SaveTransfer::OnTransfer: couldn't update save entry in saveinfo.xml: %s", saveinfo.generic_u8string().c_str());
cemuLog_log(LogType::Force, "SaveTransfer::OnTransfer: couldn't update save entry in saveinfo.xml: {}", _pathToUtf8(saveinfo));
std::error_code ec;
fs::rename(source_path, target_path, ec);