Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush logs before exiting the app. #1764

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Signal/src/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ @implementation AppDelegate

- (void)applicationDidEnterBackground:(UIApplication *)application {
DDLogWarn(@"%@ applicationDidEnterBackground.", self.tag);

[DDLog flushLog];
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
Expand All @@ -68,6 +70,8 @@ - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
- (void)applicationWillTerminate:(UIApplication *)application
{
DDLogWarn(@"%@ applicationWillTerminate.", self.tag);

[DDLog flushLog];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Expand Down Expand Up @@ -312,6 +316,8 @@ - (void)applicationWillResignActive:(UIApplication *)application {
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});

[DDLog flushLog];
}

- (void)application:(UIApplication *)application
Expand Down Expand Up @@ -543,6 +549,7 @@ - (void)verifyDBKeysAvailableBeforeBackgroundLaunch

if (![TSStorageManager isDatabasePasswordAccessible]) {
DDLogInfo(@"%@ exiting because we are in the background and the database password is not accessible.", self.tag);
[DDLog flushLog];
exit(0);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Signal/src/contact/OWSContactsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ + (void)blockingContactDialog {
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ADDRESSBOOK_RESTRICTED_ALERT_BUTTON", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
exit(0);
[DDLog flushLog];
exit(0);
}]];

[[UIApplication sharedApplication]
Expand Down
16 changes: 16 additions & 0 deletions Signal/src/environment/Environment.m
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,26 @@ + (void)messageGroup:(TSGroupThread *)groupThread {
}

+ (void)resetAppData {
// This _should_ be wiped out below.
DDLogError(@"%@ %s", self.tag, __PRETTY_FUNCTION__);
[DDLog flushLog];

[[TSStorageManager sharedManager] resetSignalStorage];
[Environment.preferences clear];
[DebugLogger.sharedLogger wipeLogs];
exit(0);
}

#pragma mark - Logging

+ (NSString *)tag
{
return [NSString stringWithFormat:@"[%@]", self.class];
}

- (NSString *)tag
{
return self.class.tag;
}

@end
1 change: 1 addition & 0 deletions Signal/src/environment/VersionMigrations.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ + (void)performUpdateCheck
UIAlertAction *quitAction = [UIAlertAction actionWithTitle:@"Quit"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) {
[DDLog flushLog];
exit(0);
}];
[alertController addAction:quitAction];
Expand Down