From ffbf3d71f0f3b96108f9a01c2ac559851c902a9e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 25 Nov 2020 21:13:50 -0500 Subject: [PATCH] Frontends: Migrate logs over to fmt --- Source/Core/DolphinQt/ConvertDialog.cpp | 4 ++-- Source/Core/DolphinQt/GCMemcardManager.cpp | 8 ++++---- Source/Core/DolphinQt/MenuBar.cpp | 4 ++-- Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp | 6 +++--- Source/Core/DolphinQt/Translation.cpp | 14 +++++++------- Source/Core/UICommon/X11Utils.cpp | 14 +++++++------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Source/Core/DolphinQt/ConvertDialog.cpp b/Source/Core/DolphinQt/ConvertDialog.cpp index a14e728c40..2a0f654985 100644 --- a/Source/Core/DolphinQt/ConvertDialog.cpp +++ b/Source/Core/DolphinQt/ConvertDialog.cpp @@ -184,8 +184,8 @@ void ConvertDialog::OnFormatChanged() constexpr int FALLBACK_BLOCK_SIZE = 0x4000; if (!block_size_ok(FALLBACK_BLOCK_SIZE)) { - ERROR_LOG(MASTER_LOG, "Failed to find a block size which does not cause problems " - "when decompressing using an old version of Dolphin"); + ERROR_LOG_FMT(MASTER_LOG, "Failed to find a block size which does not cause problems " + "when decompressing using an old version of Dolphin"); } AddToBlockSizeComboBox(FALLBACK_BLOCK_SIZE); } diff --git a/Source/Core/DolphinQt/GCMemcardManager.cpp b/Source/Core/DolphinQt/GCMemcardManager.cpp index 60dd5ece79..c66ee3c10f 100644 --- a/Source/Core/DolphinQt/GCMemcardManager.cpp +++ b/Source/Core/DolphinQt/GCMemcardManager.cpp @@ -373,7 +373,7 @@ void GCMemcardManager::ImportFile() } if (!m_slot_memcard[m_active_slot]->Save()) - PanicAlertT("File write failed"); + PanicAlertFmtT("File write failed"); UpdateSlotTable(m_active_slot); } @@ -401,7 +401,7 @@ void GCMemcardManager::CopyFiles() for (int i = 0; i < SLOT_COUNT; i++) { if (!m_slot_memcard[i]->Save()) - PanicAlertT("File write failed"); + PanicAlertFmtT("File write failed"); UpdateSlotTable(i); } @@ -444,7 +444,7 @@ void GCMemcardManager::DeleteFiles() if (!memcard->Save()) { - PanicAlertT("File write failed"); + PanicAlertFmtT("File write failed"); } else { @@ -461,7 +461,7 @@ void GCMemcardManager::FixChecksums() memcard->FixChecksums(); if (!memcard->Save()) - PanicAlertT("File write failed"); + PanicAlertFmtT("File write failed"); } void GCMemcardManager::CreateNewCard(int slot) diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index 3c5653913d..94c322e8e8 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -1601,10 +1601,10 @@ void MenuBar::SearchInstruction() QString::fromStdString(PPCTables::GetInstructionName(PowerPC::HostRead_U32(addr))); if (op == ins_name) { - NOTICE_LOG(POWERPC, "Found %s at %08x", op.toStdString().c_str(), addr); + NOTICE_LOG_FMT(POWERPC, "Found {} at {:08x}", op.toStdString(), addr); found = true; } } if (!found) - NOTICE_LOG(POWERPC, "Opcode %s not found", op.toStdString().c_str()); + NOTICE_LOG_FMT(POWERPC, "Opcode {} not found", op.toStdString()); } diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index a31384aee4..c8b19678b3 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -427,7 +427,7 @@ void NetPlayDialog::OnStart() const auto game = FindGameFile(m_current_game_identifier); if (!game) { - PanicAlertT("Selected game doesn't exist in game list!"); + PanicAlertFmtT("Selected game doesn't exist in game list!"); return; } @@ -876,7 +876,7 @@ void NetPlayDialog::OnMsgStartGame() if (auto game = FindGameFile(m_current_game_identifier)) client->StartGame(game->GetFilePath()); else - PanicAlertT("Selected game doesn't exist in game list!"); + PanicAlertFmtT("Selected game doesn't exist in game list!"); } UpdateDiscordPresence(); }); @@ -1099,7 +1099,7 @@ void NetPlayDialog::LoadSettings() } else { - WARN_LOG(NETPLAY, "Unknown network mode '%s', using 'fixeddelay'", network_mode.c_str()); + WARN_LOG_FMT(NETPLAY, "Unknown network mode '{}', using 'fixeddelay'", network_mode); m_fixed_delay_action->setChecked(true); } } diff --git a/Source/Core/DolphinQt/Translation.cpp b/Source/Core/DolphinQt/Translation.cpp index f1b8d721a9..335f0cd098 100644 --- a/Source/Core/DolphinQt/Translation.cpp +++ b/Source/Core/DolphinQt/Translation.cpp @@ -150,24 +150,24 @@ public: if (!file) { - WARN_LOG(COMMON, "Error reading MO file '%s'", filename.c_str()); + WARN_LOG_FMT(COMMON, "Error reading MO file '{}'", filename); m_data = {}; return; } - u32 magic = ReadU32(&m_data[0]); + const u32 magic = ReadU32(&m_data[0]); if (magic != MO_MAGIC_NUMBER) { - ERROR_LOG(COMMON, "MO file '%s' has bad magic number %x\n", filename.c_str(), magic); + ERROR_LOG_FMT(COMMON, "MO file '{}' has bad magic number {:x}\n", filename, magic); m_data = {}; return; } - u16 version_major = ReadU16(&m_data[4]); + const u16 version_major = ReadU16(&m_data[4]); if (version_major > 1) { - ERROR_LOG(COMMON, "MO file '%s' has unsupported version number %i", filename.c_str(), - version_major); + ERROR_LOG_FMT(COMMON, "MO file '{}' has unsupported version number {}", filename, + version_major); m_data = {}; return; } @@ -300,7 +300,7 @@ static bool TryInstallTranslator(const QString& exact_language_code) } translator->deleteLater(); } - ERROR_LOG(COMMON, "No suitable translation file found"); + ERROR_LOG_FMT(COMMON, "No suitable translation file found"); return false; } diff --git a/Source/Core/UICommon/X11Utils.cpp b/Source/Core/UICommon/X11Utils.cpp index b59931b0df..24317d8a04 100644 --- a/Source/Core/UICommon/X11Utils.cpp +++ b/Source/Core/UICommon/X11Utils.cpp @@ -39,7 +39,7 @@ bool ToggleFullscreen(Display* dpy, Window win) if (!XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureRedirectMask | SubstructureNotifyMask, &event)) { - ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode."); + ERROR_LOG_FMT(VIDEO, "Failed to switch fullscreen/windowed mode."); return false; } @@ -60,7 +60,7 @@ void InhibitScreensaver(Window win, bool suspend) while (waitpid(pid, &status, 0) == -1) ; - INFO_LOG(VIDEO, "Started xdg-screensaver (PID = %d)", (int)pid); + INFO_LOG_FMT(VIDEO, "Started xdg-screensaver (PID = {})", pid); } } @@ -75,7 +75,7 @@ XRRConfiguration::XRRConfiguration(Display* _dpy, Window _win) if (!XRRQueryVersion(dpy, &XRRMajorVersion, &XRRMinorVersion) || (XRRMajorVersion < 1 || (XRRMajorVersion == 1 && XRRMinorVersion < 3))) { - WARN_LOG(VIDEO, "XRRExtension not supported."); + WARN_LOG_FMT(VIDEO, "XRRExtension not supported."); bValid = false; return; } @@ -88,7 +88,7 @@ XRRConfiguration::XRRConfiguration(Display* _dpy, Window _win) fb_width_mm = DisplayWidthMM(dpy, screen); fb_height_mm = DisplayHeightMM(dpy, screen); - INFO_LOG(VIDEO, "XRRExtension-Version %d.%d", XRRMajorVersion, XRRMinorVersion); + INFO_LOG_FMT(VIDEO, "XRRExtension-Version {}.{}", XRRMajorVersion, XRRMinorVersion); Update(); } @@ -204,12 +204,12 @@ void XRRConfiguration::Update() if (outputInfo && crtcInfo && fullMode) { - INFO_LOG(VIDEO, "Fullscreen Resolution %dx%d", fullWidth, fullHeight); + INFO_LOG_FMT(VIDEO, "Fullscreen Resolution {}x{}", fullWidth, fullHeight); } else { - ERROR_LOG(VIDEO, "Failed to obtain fullscreen size.\n" - "Using current desktop resolution for fullscreen."); + ERROR_LOG_FMT(VIDEO, "Failed to obtain fullscreen size.\n" + "Using current desktop resolution for fullscreen."); } }