Skip to content

Commit

Permalink
Update logger.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Pax1601 committed Jul 22, 2024
1 parent 1d3d8ca commit c630fe3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/logger/src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ Logger* Logger::GetLogger()
void Logger::setDirectory(string newDirPath)
{
m_dirPath = newDirPath;
Clear();
}

void Logger::Clear()
{
lock_guard<mutex> guard(mutexLock);
try {
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | std::ios::trunc);
m_Logfile.open((m_dirPath + m_sFileName).c_str(), ios::out | ios::trunc);
}
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::trunc);
m_Logfile.open((m_dirPath.string() + m_sFileName).c_str(), ios::out | ios::trunc);
}
m_Logfile << "Creating a new log instance\n";
m_pThis->Close();
Expand Down

0 comments on commit c630fe3

Please sign in to comment.