[Log] Remove log_settings.json during installation and set default level to trace (#10438)

This commit is contained in:
Andrey Nekrasov
2021-03-25 17:28:29 +03:00
committed by GitHub
parent 718289c115
commit aac479f58c
4 changed files with 27 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
#include <common/utils/resources.h>
#include <common/utils/window.h>
#include <common/utils/winapi_error.h>
#include <common/SettingsAPI/settings_helpers.h>
#include <runner/action_runner_utils.h>
@@ -79,6 +80,27 @@ void SetupLogger(fs::path directory, const spdlog::level::level_enum severity)
}
}
void CleanupSettingsFromOlderVersions()
{
try
{
const auto logSettingsFile = fs::path{ PTSettingsHelper::get_root_save_folder_location() } / PTSettingsHelper::log_settings_filename;
if (fs::is_regular_file(logSettingsFile))
{
fs::remove(logSettingsFile);
spdlog::info("Removed old log settings file");
}
else
{
spdlog::info("Old log settings file wasn't found");
}
}
catch(...)
{
spdlog::error("Failed to cleanup old log settings");
}
}
void ShowMessageBoxError(const wchar_t* message)
{
if (!g_Silent)
@@ -379,6 +401,8 @@ int Bootstrapper(HINSTANCE hInstance)
spdlog::error("Unknown exception during dotnet installation");
ShowMessageBoxError(IDS_DOTNET_INSTALL_ERROR);
}
CleanupSettingsFromOlderVersions();
// At this point, there's no reason to show progress bar window, since MSI installers have their own
CloseProgressBarDialog();