From c630fe304561317051dc733d3ea6280bc3102dc9 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Mon, 22 Jul 2024 18:46:20 +0200 Subject: [PATCH] Update logger.cpp --- backend/logger/src/logger.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/logger/src/logger.cpp b/backend/logger/src/logger.cpp index 27b10ecdc..17809eeba 100644 --- a/backend/logger/src/logger.cpp +++ b/backend/logger/src/logger.cpp @@ -27,17 +27,18 @@ Logger* Logger::GetLogger() void Logger::setDirectory(string newDirPath) { m_dirPath = newDirPath; + Clear(); } void Logger::Clear() { lock_guard 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();