fix debug mode at startup

This commit is contained in:
Jehan Monnier 2012-10-05 10:48:44 +02:00
parent a235cedb74
commit fb0b43addc
2 changed files with 9 additions and 5 deletions

View file

@ -216,8 +216,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
[self setBool: lp_config_get_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "rfc_dtmf_preference", 1) forKey:@"rfc_dtmf_preference"];
}
if (lp_config_get_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "debugenable_preference",0))
linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
[changedDict release];
changedDict = [[NSMutableDictionary alloc] init];
@ -499,7 +498,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
lp_config_set_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "debugenable_preference", debugmode);
if (debugmode) linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
else linphone_core_disable_logs();
[[NSUserDefaults standardUserDefaults] setBool:debugmode forKey:@"debugenable_preference"]; //to be used at linphone core startup
BOOL animations = [self boolForKey:@"animations_preference"];
lp_config_set_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "animations_preference", animations);
NSString* sharing_server = [self stringForKey:@"sharing_server_preference"];

View file

@ -655,8 +655,12 @@ static LinphoneCoreVTable linphonec_vtable = {
#endif
[self setupGSMInteraction];
/* Initialize linphone core*/
[LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"];
linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
/*to make sure we don't loose debug trace*/
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"debugenable_preference"]) {
linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
}
[LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"];
theLinphoneCore = linphone_core_new (&linphonec_vtable
, [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]
, [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]]