mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #898 from Pax1601/release-candidate
Fixed error logger clearing file at all logs
This commit is contained in:
commit
97a11d6873
@ -25,6 +25,7 @@ private:
|
||||
|
||||
mutex mutexLock;
|
||||
|
||||
void Clear();
|
||||
void Open();
|
||||
void Close();
|
||||
};
|
||||
|
||||
@ -19,6 +19,7 @@ Logger* Logger::GetLogger()
|
||||
{
|
||||
if (m_pThis == NULL) {
|
||||
m_pThis = new Logger();
|
||||
m_pThis->Clear();
|
||||
}
|
||||
return m_pThis;
|
||||
}
|
||||
@ -28,7 +29,7 @@ void Logger::setDirectory(string newDirPath)
|
||||
m_dirPath = newDirPath;
|
||||
}
|
||||
|
||||
void Logger::Open()
|
||||
void Logger::Clear()
|
||||
{
|
||||
try {
|
||||
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | std::ios::trunc);
|
||||
@ -39,6 +40,17 @@ void Logger::Open()
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::Open()
|
||||
{
|
||||
try {
|
||||
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | std::ios::app);
|
||||
}
|
||||
catch (...) {
|
||||
std::filesystem::path m_dirPath = std::filesystem::temp_directory_path();
|
||||
m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | std::ios::app);
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::Close()
|
||||
{
|
||||
m_Logfile.close();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user