1
1
Fork 0
forked from suyu/suyu

Merge pull request #406 from lioncash/frontend

frontends: Move logging macros over to new fmt-capable ones
This commit is contained in:
bunnei 2018-04-26 22:53:42 -04:00 committed by GitHub
commit 4f120a9ec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 27 deletions

View file

@ -315,7 +315,8 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
if (!FileUtil::Exists(dir_path.toStdString()) || if (!FileUtil::Exists(dir_path.toStdString()) ||
!FileUtil::IsDirectory(dir_path.toStdString())) { !FileUtil::IsDirectory(dir_path.toStdString())) {
LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data()); NGLOG_ERROR(Frontend, "Could not find game list folder at {}",
dir_path.toLocal8Bit().data());
search_field->setFilterResult(0, 0); search_field->setFilterResult(0, 0);
return; return;
} }
@ -364,7 +365,7 @@ static bool HasSupportedFileExtension(const std::string& file_name) {
void GameList::RefreshGameDirectory() { void GameList::RefreshGameDirectory() {
if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) { if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) {
LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list."); NGLOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
search_field->clear(); search_field->clear();
PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
} }

View file

@ -359,19 +359,17 @@ bool GMainWindow::LoadROM(const QString& filename) {
if (result != Core::System::ResultStatus::Success) { if (result != Core::System::ResultStatus::Success) {
switch (result) { switch (result) {
case Core::System::ResultStatus::ErrorGetLoader: case Core::System::ResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", NGLOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
filename.toStdString().c_str());
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM format is not supported.")); tr("The ROM format is not supported."));
break; break;
case Core::System::ResultStatus::ErrorUnsupportedArch: case Core::System::ResultStatus::ErrorUnsupportedArch:
LOG_CRITICAL(Frontend, "Unsupported architecture detected!", NGLOG_CRITICAL(Frontend, "Unsupported architecture detected!", filename.toStdString());
filename.toStdString().c_str());
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM uses currently unusable 32-bit architecture")); tr("The ROM uses currently unusable 32-bit architecture"));
break; break;
case Core::System::ResultStatus::ErrorSystemMode: case Core::System::ResultStatus::ErrorSystemMode:
LOG_CRITICAL(Frontend, "Failed to load ROM!"); NGLOG_CRITICAL(Frontend, "Failed to load ROM!");
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("Could not determine the system mode.")); tr("Could not determine the system mode."));
break; break;
@ -859,7 +857,7 @@ void GMainWindow::UpdateUITheme() {
QString theme_uri(":" + UISettings::values.theme + "/style.qss"); QString theme_uri(":" + UISettings::values.theme + "/style.qss");
QFile f(theme_uri); QFile f(theme_uri);
if (!f.exists()) { if (!f.exists()) {
LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found"); NGLOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
} else { } else {
f.open(QFile::ReadOnly | QFile::Text); f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f); QTextStream ts(&f);

View file

@ -27,17 +27,17 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
const char* location = this->sdl2_config_loc.c_str(); const char* location = this->sdl2_config_loc.c_str();
if (sdl2_config->ParseError() < 0) { if (sdl2_config->ParseError() < 0) {
if (retry) { if (retry) {
LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location); NGLOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
FileUtil::CreateFullPath(location); FileUtil::CreateFullPath(location);
FileUtil::WriteStringToFile(true, default_contents, location); FileUtil::WriteStringToFile(true, default_contents, location);
sdl2_config = std::make_unique<INIReader>(location); // Reopen file sdl2_config = std::make_unique<INIReader>(location); // Reopen file
return LoadINI(default_contents, false); return LoadINI(default_contents, false);
} }
LOG_ERROR(Config, "Failed."); NGLOG_ERROR(Config, "Failed.");
return false; return false;
} }
LOG_INFO(Config, "Successfully loaded %s", location); NGLOG_INFO(Config, "Successfully loaded {}", location);
return true; return true;
} }

View file

@ -84,7 +84,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
// Initialize the window // Initialize the window
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting..."); NGLOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting...");
exit(1); exit(1);
} }
@ -107,7 +107,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
if (render_window == nullptr) { if (render_window == nullptr) {
LOG_CRITICAL(Frontend, "Failed to create SDL2 window! Exiting..."); NGLOG_CRITICAL(Frontend, "Failed to create SDL2 window! Exiting...");
exit(1); exit(1);
} }
@ -118,12 +118,12 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
gl_context = SDL_GL_CreateContext(render_window); gl_context = SDL_GL_CreateContext(render_window);
if (gl_context == nullptr) { if (gl_context == nullptr) {
LOG_CRITICAL(Frontend, "Failed to create SDL2 GL context! Exiting..."); NGLOG_CRITICAL(Frontend, "Failed to create SDL2 GL context! Exiting...");
exit(1); exit(1);
} }
if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) { if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) {
LOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting..."); NGLOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting...");
exit(1); exit(1);
} }

View file

@ -71,7 +71,7 @@ int main(int argc, char** argv) {
auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w);
if (argv_w == nullptr) { if (argv_w == nullptr) {
LOG_CRITICAL(Frontend, "Failed to get command line arguments"); NGLOG_CRITICAL(Frontend, "Failed to get command line arguments");
return -1; return -1;
} }
#endif #endif
@ -134,7 +134,7 @@ int main(int argc, char** argv) {
SCOPE_EXIT({ MicroProfileShutdown(); }); SCOPE_EXIT({ MicroProfileShutdown(); });
if (filepath.empty()) { if (filepath.empty()) {
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); NGLOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
return -1; return -1;
} }
@ -155,28 +155,28 @@ int main(int argc, char** argv) {
switch (load_result) { switch (load_result) {
case Core::System::ResultStatus::ErrorGetLoader: case Core::System::ResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filepath.c_str()); NGLOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filepath.c_str());
return -1; return -1;
case Core::System::ResultStatus::ErrorLoader: case Core::System::ResultStatus::ErrorLoader:
LOG_CRITICAL(Frontend, "Failed to load ROM!"); NGLOG_CRITICAL(Frontend, "Failed to load ROM!");
return -1; return -1;
case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted:
LOG_CRITICAL(Frontend, "The game that you are trying to load must be decrypted before " NGLOG_CRITICAL(Frontend, "The game that you are trying to load must be decrypted before "
"being used with yuzu. \n\n For more information on dumping and " "being used with yuzu. \n\n For more information on dumping and "
"decrypting games, please refer to: " "decrypting games, please refer to: "
"https://yuzu-emu.org/wiki/dumping-game-cartridges/"); "https://yuzu-emu.org/wiki/dumping-game-cartridges/");
return -1; return -1;
case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
LOG_CRITICAL(Frontend, "Error while loading ROM: The ROM format is not supported."); NGLOG_CRITICAL(Frontend, "Error while loading ROM: The ROM format is not supported.");
return -1; return -1;
case Core::System::ResultStatus::ErrorNotInitialized: case Core::System::ResultStatus::ErrorNotInitialized:
LOG_CRITICAL(Frontend, "CPUCore not initialized"); NGLOG_CRITICAL(Frontend, "CPUCore not initialized");
return -1; return -1;
case Core::System::ResultStatus::ErrorSystemMode: case Core::System::ResultStatus::ErrorSystemMode:
LOG_CRITICAL(Frontend, "Failed to determine system mode!"); NGLOG_CRITICAL(Frontend, "Failed to determine system mode!");
return -1; return -1;
case Core::System::ResultStatus::ErrorVideoCore: case Core::System::ResultStatus::ErrorVideoCore:
LOG_CRITICAL(Frontend, "VideoCore not initialized"); NGLOG_CRITICAL(Frontend, "VideoCore not initialized");
return -1; return -1;
case Core::System::ResultStatus::Success: case Core::System::ResultStatus::Success:
break; // Expected case break; // Expected case