glog icon indicating copy to clipboard operation
glog copied to clipboard

Fixed IsLogFromCurrentProject to include all severities

Open Mivekk opened this issue 1 year ago • 6 comments

Previously when executing following code LogCleaner would only delete overdue Error log files:

google::EnableLogCleaner(1min);

LOG(ERROR) << "Error hello";
LOG(INFO) << "Info hello";
LOG(WARNING) << "Warning hello";

And if we changed the order to for example:

LOG(INFO) << "Info hello";
LOG(ERROR) << "Error hello";
LOG(WARNING) << "Warning hello";

LogCleaner would only delete overdue Info log files and overdue Error and Warning files were ignored. To include all severities during LogCleaner's sweep I tested filepath for all severities in a IsLogFromCurrentProject function.

Mivekk avatar Jan 15 '24 12:01 Mivekk

I'm not sure how I should modify cleaner test cases unfortunately

Mivekk avatar Jan 16 '24 09:01 Mivekk

You can extend any of the cleanup_*_unittest.cc, for instance, here https://github.com/google/glog/blob/ac12a9e79440a2a89cc1c5617bb8f6db02035182/src/cleanup_immediately_unittest.cc#L62-L64 by additionally logging at the missing severities.

Please note that the unit tests need to be updated either way because these are failing now with your changes.

sergiud avatar Jan 16 '24 09:01 sergiud

Updated unit test and all checks should pass now hopefully

Mivekk avatar Jan 16 '24 10:01 Mivekk

Unfortunately, the cleanup tests are still failing.

sergiud avatar Jan 16 '24 10:01 sergiud

Fixed an issue different way

Mivekk avatar Jan 31 '24 11:01 Mivekk

The unit tests are still failing though.

sergiud avatar Feb 01 '24 10:02 sergiud

Closing as abandoned. Please let me know if you want to continue working on this PR.

sergiud avatar Jun 11 '24 19:06 sergiud