Delete the old log file before rotating (#5675)

master
xperia64 2021-01-03 19:53:23 +07:00 committed by FearlessTobi
parent bf8bd60ab3
commit fd5776aac2
1 changed files with 3 additions and 0 deletions

@ -146,6 +146,9 @@ void ColorConsoleBackend::Write(const Entry& entry) {
} }
FileBackend::FileBackend(const std::string& filename) : bytes_written(0) { FileBackend::FileBackend(const std::string& filename) : bytes_written(0) {
if (FileUtil::Exists(filename + ".old.txt")) {
FileUtil::Delete(filename + ".old.txt");
}
if (FileUtil::Exists(filename)) { if (FileUtil::Exists(filename)) {
FileUtil::Rename(filename, filename + ".old.txt"); FileUtil::Rename(filename, filename + ".old.txt");
} }