Skip to content

Commit

Permalink
logging: log_cleaner: remove the range-based loops
Browse files Browse the repository at this point in the history
Also replaced the hardcoded overdue days with the correct variable.
  • Loading branch information
aesophor committed Aug 21, 2019
1 parent 5eef96f commit b8a61d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1238,9 +1238,11 @@ void LogFileObject::Write(bool force_flush,
#endif
// Perform clean up for old logs
if (log_cleaner_enabled_) {
for (const auto& dir : GetLoggingDirectories()) {
for (const auto& name : GetOverdueLogNames(dir, 3)) {
static_cast<void>(unlink(name.c_str()));
const vector<string>& dirs = GetLoggingDirectories();
for (size_t i = 0; i < dirs.size(); i++) {
vector<string> logs = GetOverdueLogNames(dirs[i], log_cleaner_overdue_days_);
for (size_t j = 0; j < logs.size(); j++) {
static_cast<void>(unlink(logs[j].c_str()));
}
}
}
Expand Down

0 comments on commit b8a61d7

Please sign in to comment.