mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Merge pull request #456 from vslavik/defer-SUClearLog
Don't call SUClearLog() unless logging something
This commit is contained in:
commit
760a1589ba
2 files changed
+7
-3
No files matched your search
Vendored
+7
@@ -37,6 +37,7 @@ void SUClearLog(void)
|
||||
FILE *logfile = fopen([[SULogFilePath stringByExpandingTildeInPath] fileSystemRepresentation], "w");
|
||||
if (logfile) {
|
||||
fclose(logfile);
|
||||
SULog(@"===== %@ =====", [[NSFileManager defaultManager] displayNameAtPath:[[NSBundle mainBundle] bundlePath]]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +54,12 @@ void SUClearLog(void)
|
||||
|
||||
void SULog(NSString *format, ...)
|
||||
{
|
||||
static BOOL loggedYet = NO;
|
||||
if (!loggedYet) {
|
||||
loggedYet = YES;
|
||||
SUClearLog();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
NSString *theStr = [[NSString alloc] initWithFormat:format arguments:ap];
|
||||
|
||||
Vendored
-3
@@ -332,9 +332,6 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
if ([self updateInProgress]) { return; }
|
||||
if (self.checkTimer) { [self.checkTimer invalidate]; self.checkTimer = nil; } // Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
|
||||
SUClearLog();
|
||||
SULog(@"===== %@ =====", [[NSFileManager defaultManager] displayNameAtPath:[[NSBundle mainBundle] bundlePath]]);
|
||||
|
||||
[self willChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
[self.host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey];
|
||||
[self didChangeValueForKey:@"lastUpdateCheckDate"];
|
||||
|
||||
Reference in new issue
Block a user