Save the log file during exit

This will save the current log to the Audacity config directory and
a name of "lastlog.txt".  This is for diagnosing errors that may
occur during Audacity exit.
This commit is contained in:
Leland Lucius 2021-04-03 14:09:52 -05:00
parent cca372fb92
commit 19df017d1f
1 changed files with 8 additions and 0 deletions

View File

@ -432,6 +432,14 @@ static void QuitAudacity(bool bForce)
//temporarily commented out till it is added to all projects
//DELETE Profiler::Instance();
// Save last log for diagnosis
auto logger = AudacityLogger::Get();
if (logger)
{
wxFileName logFile(FileNames::DataDir(), wxT("lastlog.txt"));
logger->SaveLog(logFile.GetFullPath());
}
//remove our logger
std::unique_ptr<wxLog>{ wxLog::SetActiveTarget(NULL) }; // DELETE