@@ -450,6 +450,9 @@ class LogCleaner {
450450 void Enable (const LogSeverity severity, const std::chrono::minutes& overdue);
451451 void Disable ();
452452 void Disable (const LogSeverity severity);
453+ // For files with no severity in their names
454+ void EnableForGenericLogs (const std::chrono::minutes& overdue);
455+ void DisableForGenericLogs ();
453456
454457 void Run (const std::chrono::system_clock::time_point& current_time,
455458 bool base_filename_selected, const string& base_filename,
@@ -1295,11 +1298,11 @@ void LogFileObject::Write(
12951298LogCleaner::LogCleaner () = default ;
12961299
12971300void LogCleaner::Enable (const std::chrono::minutes& overdue) {
1298- // for the files that have no severity specified
1299- overdue_[- 1 ] = overdue;
1300- // for backward compatability, set all severities to the same value
1301+ // For the files that have no severity specified, we use -1 as the key
1302+ EnableForGenericLogs ( overdue) ;
1303+ // For backward compatability, set all severities to the same value
13011304 for (int i = GLOG_INFO; i < NUM_SEVERITIES; i++) {
1302- overdue_[i] = overdue;
1305+ Enable ( static_cast <LogSeverity>(i), overdue) ;
13031306 }
13041307}
13051308
@@ -1313,6 +1316,14 @@ void LogCleaner::Disable(const LogSeverity severity) {
13131316 overdue_.erase (severity);
13141317}
13151318
1319+ void LogCleaner::EnableForGenericLogs (const std::chrono::minutes& overdue) {
1320+ overdue_[-1 ] = overdue;
1321+ }
1322+
1323+ void LogCleaner::DisableForGenericLogs () {
1324+ overdue_.erase (-1 );
1325+ }
1326+
13161327void LogCleaner::Run (const std::chrono::system_clock::time_point& current_time,
13171328 bool base_filename_selected, const string& base_filename,
13181329 const string& filename_extension) {
@@ -2659,12 +2670,20 @@ void EnableLogCleaner(LogSeverity severity, const std::chrono::minutes& overdue)
26592670 log_cleaner.Enable (severity, overdue);
26602671}
26612672
2673+ void EnableLogCleanerForGenericLogs (const std::chrono::minutes& overdue) {
2674+ log_cleaner.EnableForGenericLogs (overdue);
2675+ }
2676+
26622677void DisableLogCleaner () { log_cleaner.Disable (); }
26632678
26642679void DisableLogCleaner (LogSeverity severity) {
26652680 log_cleaner.Disable (severity);
26662681}
26672682
2683+ void DisableLogCleanerForGenericLogs () {
2684+ log_cleaner.DisableForGenericLogs ();
2685+ }
2686+
26682687LogMessageTime::LogMessageTime () = default ;
26692688
26702689namespace {
0 commit comments