From 5a2c4919c6c415bcb22aeae8cbd5f579aa90bcea Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 30 May 2016 09:41:45 -0400 Subject: [PATCH] close previous file first upon repon --- Log.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Log.cpp b/Log.cpp index 36fcebf3..0518fb2e 100644 --- a/Log.cpp +++ b/Log.cpp @@ -130,10 +130,13 @@ namespace log { Process(); } - void Log::SendTo (const std::string& path) { + void Log::SendTo (const std::string& path) + { + if (m_LogStream) m_LogStream = nullptr; // close previous auto flags = std::ofstream::out | std::ofstream::app; auto os = std::make_shared (path, flags); - if (os->is_open ()) { + if (os->is_open ()) + { m_Logfile = path; m_Destination = eLogFile; m_LogStream = os;