Improve error logging

This commit is contained in:
Megamouse 2023-01-07 22:11:41 +01:00
parent 36a55660bf
commit 9b7eaf5117
11 changed files with 16 additions and 13 deletions

View File

@ -1181,7 +1181,7 @@ void patch_engine::save_config(const patch_map& patches_map)
if (!file.file || (file.file.write(out.c_str(), out.size()), !file.commit()))
{
patch_log.error("Failed to create patch config file %s (%s)", path, fs::g_tls_error);
patch_log.error("Failed to create patch config file %s (error=%s)", path, fs::g_tls_error);
}
}

View File

@ -140,7 +140,7 @@ void music_selection_context::create_playlist(const std::string& new_hash)
if (!file.file || (file.file.write(out.c_str(), out.size()), !file.commit()))
{
cellMusicSelectionContext.error("Failed to create music playlist file %s (%s)", yaml_path, fs::g_tls_error);
cellMusicSelectionContext.error("Failed to create music playlist file %s (error=%s)", yaml_path, fs::g_tls_error);
}
}

View File

@ -36,7 +36,7 @@ void cfg_ipc::save() const
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{
IPC.error("Could not save config: %s", cfg_ipc::get_path());
IPC.error("Could not save config: %s (error=%s)", cfg_ipc::get_path(), fs::g_tls_error);
}
}

View File

@ -38,7 +38,7 @@ void cfg_camera::save() const
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{
camera_log.error("Failed to save camera config to '%s'", path);
camera_log.error("Failed to save camera config to '%s' (error=%s)", path, fs::g_tls_error);
}
}

View File

@ -73,7 +73,7 @@ void cfg_input::save(const std::string& title_id, const std::string& profile) co
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{
input_log.error("Failed to save pad config to '%s'", cfg_name);
input_log.error("Failed to save pad config to '%s' (error=%s)", cfg_name, fs::g_tls_error);
}
}
@ -101,6 +101,6 @@ void cfg_profile::save() const
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{
input_log.error("Failed to save pad profile config to '%s'", path);
input_log.error("Failed to save pad profile config to '%s' (error=%s)", path, fs::g_tls_error);
}
}

View File

@ -39,6 +39,6 @@ void cfg_recording::save() const
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{
cfg_log.error("Failed to save recording config to '%s'", path);
cfg_log.error("Failed to save recording config to '%s' (error=%s)", path, fs::g_tls_error);
}
}

View File

@ -45,7 +45,7 @@ void cfg_rpcn::save() const
if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit()))
{
rpcn_log.error("Could not save config: %s", cfg_rpcn::get_path());
rpcn_log.error("Could not save config: %s (error=%s)", cfg_rpcn::get_path(), fs::g_tls_error);
}
}

View File

@ -1541,7 +1541,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
// Do not update games.yml when TITLE_ID is empty
if (!temp.file || temp.file.write(out.c_str(), out.size()), !temp.commit())
{
sys_log.error("Failed to save BDVD location of title '%s' (%s)", m_title_id, fs::g_tls_error);
sys_log.error("Failed to save BDVD location of title '%s' (error=%s)", m_title_id, fs::g_tls_error);
}
}
}
@ -1597,7 +1597,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
if (!temp.file || temp.file.write(out.c_str(), out.size()), !temp.commit())
{
sys_log.error("Failed to save HG game location of title '%s' (%s)", m_title_id, fs::g_tls_error);
sys_log.error("Failed to save HG game location of title '%s' (error=%s)", m_title_id, fs::g_tls_error);
}
vfs::mount("/dev_hdd0/game/" + m_title_id, m_sfo_dir + '/');

View File

@ -111,7 +111,7 @@ void cfg_vfs::save() const
if (!temp.file)
{
vfs_log.error("Could not save config: \"%s\"", cfg_vfs::get_path());
vfs_log.error("Could not save config: \"%s\" (error=%s)", cfg_vfs::get_path(), fs::g_tls_error);
return;
}

View File

@ -284,7 +284,10 @@ void emu_settings::SaveSettings()
// Save config atomically
fs::pending_file temp(config_name);
temp.file.write(out.c_str(), out.size());
temp.commit();
if (!temp.commit())
{
cfg_log.error("Could not save config to %s (error=%s)", config_name, fs::g_tls_error);
}
// Check if the running config/title is the same as the edited config/title.
if (config_name == g_cfg.name || m_title_id == Emu.GetTitleID())

View File

@ -1034,7 +1034,7 @@ bool patch_manager_dialog::handle_json(const QByteArray& data)
if (!patch_file.file || (patch_file.file.write(content), !patch_file.commit()))
{
patch_log.error("Could not save new patches to %s (%s)", path, fs::g_tls_error);
patch_log.error("Could not save new patches to %s (error=%s)", path, fs::g_tls_error);
return false;
}