settings: fix log collection

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-26 14:32:25 +01:00
parent 523715edb9
commit 44a4d9b365
11 changed files with 14 additions and 3 deletions

View file

@ -525,7 +525,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"flush_images_button"];
#endif
if (![LinphoneManager.instance lpConfigBoolForKey:@"debugenable_preference"]) {
int debugLevel = [LinphoneManager.instance lpConfigIntForKey:@"debugenable_preference"];
BOOL debugEnabled = (debugLevel >= ORTP_DEBUG && debugLevel < ORTP_ERROR);
if (!debugEnabled) {
[hiddenKeys addObject:@"send_logs_button"];
[hiddenKeys addObject:@"reset_logs_button"];
}
@ -756,6 +758,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[attachments addObject:@[ [NSString stringWithUTF8String:filepath], mimeType, filename ]];
}
}
ms_free(filepath);
if ([LinphoneManager.instance lpConfigBoolForKey:@"send_logs_include_linphonerc_and_chathistory"]) {
// retrieve linphone rc
@ -770,8 +773,16 @@ static UICompositeViewDescription *compositeDescription = nil;
]];
}
if (attachments.count == 0) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Cannot send logs", nil)
message:NSLocalizedString(@"Nothing could be collected from your application, aborting now.", nil)];
[alert addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];
[alert show];
return;
}
[self emailAttachments:attachments];
ms_free(filepath);
}
- (void)emailAttachments:(NSArray *)attachments {
NSString *error = nil;

View file

@ -52,8 +52,8 @@
+ (void)enableLogs:(OrtpLogLevel)level {
BOOL enabled = (level >= ORTP_DEBUG && level < ORTP_ERROR);
linphone_core_set_log_collection_path([self cacheDirectory].UTF8String);
linphone_core_enable_log_collection(enabled);
linphone_core_enable_logs_with_cb(linphone_iphone_log_handler);
linphone_core_enable_log_collection(enabled);
if (level == 0) {
linphone_core_set_log_level(ORTP_FATAL);
ortp_set_log_level("ios", ORTP_FATAL);