Add current compress/delete setting information to status report

This commit is contained in:
Richard Frith-Macdonald 2020-05-28 10:49:26 +01:00
parent 9382195eb6
commit 48d84025c4

View file

@ -502,6 +502,8 @@ static NSMutableDictionary *launchInfo = nil;
NSTimeInterval debUndeleted; NSTimeInterval debUndeleted;
NSTimeInterval logUncompressed; NSTimeInterval logUncompressed;
NSTimeInterval logUndeleted; NSTimeInterval logUndeleted;
NSInteger compressAfter;
NSInteger deleteAfter;
BOOL sweeping; BOOL sweeping;
} }
- (NSFileHandle*) openLog: (NSString*)lname; - (NSFileHandle*) openLog: (NSString*)lname;
@ -1249,7 +1251,10 @@ NSLog(@"Problem %@", localException);
} }
else if (comp(wd, @"archive") >= 0) else if (comp(wd, @"archive") >= 0)
{ {
m = [NSString stringWithFormat: @"\n%@\n\n", [self ecArchive: nil]]; NSCalendarDate *when;
m = [NSString stringWithFormat: @"\n%@\n", [self ecArchive: nil]];
when = [NSCalendarDate date];
} }
else if (comp(wd, @"help") >= 0) else if (comp(wd, @"help") >= 0)
{ {
@ -2233,6 +2238,8 @@ NSLog(@"Problem %@", localException);
(unsigned)[launching count], (unsigned)launchLimit]; (unsigned)[launching count], (unsigned)launchLimit];
[m appendFormat: @" Names: %@\n", [launching allKeys]]; [m appendFormat: @" Names: %@\n", [launching allKeys]];
} }
[m appendFormat: @" Compress/Delete after %d/%d days.\n",
(int)compressAfter, (int)deleteAfter];
return m; return m;
} }
@ -3253,7 +3260,7 @@ NSLog(@"Problem %@", localException);
- (NSString*) makeSpace - (NSString*) makeSpace
{ {
NSInteger deleteAfter; NSInteger purgeAfter;
NSTimeInterval latestDeleteAt; NSTimeInterval latestDeleteAt;
NSTimeInterval now; NSTimeInterval now;
NSTimeInterval ti; NSTimeInterval ti;
@ -3275,10 +3282,10 @@ NSLog(@"Problem %@", localException);
* would start compressing but no further ... we don't want to delete * would start compressing but no further ... we don't want to delete
* all logs! * all logs!
*/ */
deleteAfter = [[self cmdDefaults] integerForKey: @"CompressLogsAfter"]; purgeAfter = [[self cmdDefaults] integerForKey: @"CompressLogsAfter"];
if (deleteAfter < 1) if (purgeAfter < 1)
{ {
deleteAfter = 7; purgeAfter = 7;
} }
mgr = [NSFileManager defaultManager]; mgr = [NSFileManager defaultManager];
@ -3288,7 +3295,7 @@ NSLog(@"Problem %@", localException);
debUndeleted = now - 365.0 * day; debUndeleted = now - 365.0 * day;
} }
ti = debUndeleted; ti = debUndeleted;
latestDeleteAt = now - day * deleteAfter; latestDeleteAt = now - day * purgeAfter;
while (nil == gone && ti < latestDeleteAt) while (nil == gone && ti < latestDeleteAt)
{ {
when = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate: ti]; when = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate: ti];
@ -3310,8 +3317,6 @@ NSLog(@"Problem %@", localException);
- (void) _sweep: (BOOL)deb at: (NSCalendarDate*)when - (void) _sweep: (BOOL)deb at: (NSCalendarDate*)when
{ {
NSInteger compressAfter;
NSInteger deleteAfter;
NSTimeInterval uncompressed; NSTimeInterval uncompressed;
NSTimeInterval undeleted; NSTimeInterval undeleted;
NSTimeInterval latestCompressAt; NSTimeInterval latestCompressAt;
@ -3515,7 +3520,7 @@ NSLog(@"Problem %@", localException);
{ {
if (sweeping == YES) if (sweeping == YES)
{ {
NSLog(@"Argh - nested sweep attempt"); NSLog(@"Argh - nested hourly sweep attempt");
return; return;
} }
sweeping = YES; sweeping = YES;