1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 16:34:13 +00:00

close previous file first upon repon

This commit is contained in:
orignal 2016-05-30 09:41:45 -04:00
parent 09a80ed654
commit 5a2c4919c6

View File

@ -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<std::ofstream> (path, flags);
if (os->is_open ()) {
if (os->is_open ())
{
m_Logfile = path;
m_Destination = eLogFile;
m_LogStream = os;