Implement basic log rotation (closes #211) #344

Merged
gahag merged 2 commits from log-rotate into master 2019-10-29 21:21:05 +01:00
Showing only changes of commit 2d94f2e224 - Show all commits

View file

@ -37,6 +37,12 @@ bool BCLog::Logger::OpenDebugLog()
assert(m_fileout == nullptr);
assert(!m_file_path.empty());
if (fs::exists(m_file_path)) {
fs::path old_file_path(m_file_path);
old_file_path.append(".old");
fs::rename(m_file_path, old_file_path);
}
m_fileout = fsbridge::fopen(m_file_path, "a");
if (!m_fileout) {
return false;