private TempFile GetLogFile()
{
// NOTE: Logger holds a lock on the real log file, so we can't access it directly.
// Instead we create a new temporary file that holds the content of the log file.
var file = TempFile.WithFilenameInTempFolder(UsageReporter.AppNameToUseInReporting + ".log");
try
{
RobustFile.WriteAllText(file.Path, Logger.LogText);
}
catch (Exception err)
{
//We have more than one report of dieing while logging an exception.
RobustFile.WriteAllText(file.Path, "****Could not read from log: " + err.Message);
}
return file;
}