Merge pull request #1721 from vector-im/early_log_init

AppDelegate: Enable log to file earlier
This commit is contained in:
manuroe
2018-01-02 12:08:18 +01:00
committed by GitHub
+20 -14
View File
@@ -223,6 +223,26 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
#pragma mark -
+ (void)initialize
{
NSLog(@"[AppDelegate] initialize");
// Set the App Group identifier.
MXSDKOptions *sdkOptions = [MXSDKOptions sharedInstance];
sdkOptions.applicationGroupIdentifier = @"group.im.vector";
// Track SDK performance on Google analytics
sdkOptions.analyticsDelegate = [[MXGoogleAnalytics alloc] init];
// Redirect NSLogs to files only if we are not debugging
if (!isatty(STDERR_FILENO))
{
[MXLogger redirectNSLogToFiles:YES];
}
NSLog(@"[AppDelegate] initialize: Done");
}
+ (AppDelegate*)theDelegate
{
return (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -323,20 +343,6 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions
{
NSLog(@"[AppDelegate] willFinishLaunchingWithOptions");
// Set the App Group identifier.
MXSDKOptions *sdkOptions = [MXSDKOptions sharedInstance];
sdkOptions.applicationGroupIdentifier = @"group.im.vector";
// Track SDK performance on Google analytics
sdkOptions.analyticsDelegate = [[MXGoogleAnalytics alloc] init];
// Redirect NSLogs to files only if we are not debugging
if (!isatty(STDERR_FILENO)) {
[MXLogger redirectNSLogToFiles:YES];
}
NSLog(@"[AppDelegate] willFinishLaunchingWithOptions: Done");
return YES;