diff --git a/Classes/DialerView.m b/Classes/DialerView.m
index 0a1c47227..fd87eca38 100644
--- a/Classes/DialerView.m
+++ b/Classes/DialerView.m
@@ -313,9 +313,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[alertView addButtonWithTitle:actionLog
block:^{
// enable / disable
- BOOL enableDebug = ![mgr lpConfigBoolForKey:@"debugenable_preference"];
- [mgr lpConfigSetBool:enableDebug forKey:@"debugenable_preference"];
- [mgr setLogsEnabled:enableDebug];
+ BOOL enableDebug = !debugEnabled;
+ [Log enableLogs:enableDebug];
}];
[alertView show];
diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 1b37579ce..c453ccc24 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -792,10 +792,6 @@
// advanced section
{
- BOOL debugmode = [self boolForKey:@"debugenable_preference"];
- [lm lpConfigSetInt:debugmode forKey:@"debugenable_preference"];
- [LinphoneManager.instance setLogsEnabled:debugmode];
-
BOOL animations = [self boolForKey:@"animations_preference"];
[lm lpConfigSetInt:animations forKey:@"animations_preference"];
diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h
index f48d0d6e9..3387f31cf 100644
--- a/Classes/LinphoneManager.h
+++ b/Classes/LinphoneManager.h
@@ -154,7 +154,6 @@ typedef struct _LinphoneManagerSounds {
- (bool)allowSpeaker;
- (void)configureVbrCodecs;
-- (void)setLogsEnabled:(BOOL)enabled;
+ (BOOL)copyFile:(NSString*)src destination:(NSString*)dst override:(BOOL)override;
+ (NSString*)bundleFile:(NSString*)file;
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index fa7ea0919..d21d529cd 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -1441,7 +1441,7 @@ static BOOL libStarted = FALSE;
return;
}
linphone_core_set_log_collection_path([[LinphoneManager cacheDirectory] UTF8String]);
- [self setLogsEnabled:[self lpConfigBoolForKey:@"debugenable_preference"]];
+ [Log enableLogs:([self lpConfigBoolForKey:@"debugenable_preference"] || LinphoneManager.instance.isTesting)];
connectivity = none;
ms_init(); // Need to initialize mediastreamer2 before loading the plugins
@@ -2133,25 +2133,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
}
-- (void)setLogsEnabled:(BOOL)enabled {
- if ([LinphoneManager isRunningTests]) {
- NSLog(@"Running tests, forcing logs to MESSAGE level");
- linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
- linphone_core_set_log_level(ORTP_MESSAGE);
- } else {
- if (enabled) {
- NSLog(@"Enabling debug logs");
- linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
- linphone_core_set_log_level(ORTP_DEBUG);
- linphone_core_enable_log_collection(enabled);
- } else {
- NSLog(@"Disabling debug logs");
- linphone_core_enable_log_collection(enabled);
- linphone_core_disable_logs();
- }
- }
-}
-
+ (id)getMessageAppDataForKey:(NSString *)key inMessage:(LinphoneChatMessage *)msg {
if (msg == nil)
diff --git a/Classes/Log.h b/Classes/Log.h
index b79034b48..c1d98b0c4 100644
--- a/Classes/Log.h
+++ b/Classes/Log.h
@@ -19,16 +19,19 @@
#import "LinphoneManager.h"
-#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
-#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__)
-#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__)
-#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__)
-#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__)
-#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__)
+#define APP_LVL 1 << 7
+#define LOGV(level, ...) [Log log:APP_LVL & level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
+#define LOGD(...) LOGV(APP_LVL | ORTP_DEBUG, __VA_ARGS__)
+#define LOGI(...) LOGV(APP_LVL | ORTP_MESSAGE, __VA_ARGS__)
+#define LOGW(...) LOGV(APP_LVL | ORTP_WARNING, __VA_ARGS__)
+#define LOGE(...) LOGV(APP_LVL | ORTP_ERROR, __VA_ARGS__)
+#define LOGF(...) LOGV(APP_LVL | ORTP_FATAL, __VA_ARGS__)
-@interface LinphoneLogger : NSObject {
+@interface Log : NSObject {
}
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...;
++ (void)enableLogs:(BOOL)enabled;
+
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
@end
\ No newline at end of file
diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m
index 2e7e27db1..f25e62394 100644
--- a/Classes/SettingsView.m
+++ b/Classes/SettingsView.m
@@ -414,7 +414,7 @@ static UICompositeViewDescription *compositeDescription = nil;
removeFromHiddenKeys = debugEnabled;
[keys addObject:@"send_logs_button"];
[keys addObject:@"reset_logs_button"];
- [LinphoneManager.instance setLogsEnabled:debugEnabled];
+ [Log enableLogs:(debugEnabled || LinphoneManager.instance.isTesting)];
} else if ([@"account_mandatory_advanced_preference" compare:notif.object] == NSOrderedSame) {
removeFromHiddenKeys = [[notif.userInfo objectForKey:@"account_mandatory_advanced_preference"] boolValue];
for (NSString *key in settingsStore->dict) {
@@ -535,9 +535,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"wifi_only_preference"];
- [hiddenKeys addObject:@"quit_button"]; // Hide for the moment
- [hiddenKeys addObject:@"about_button"]; // Hide for the moment
-
if (!linphone_core_video_supported(LC)) {
[hiddenKeys addObject:@"video_menu"];
}
@@ -700,8 +697,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[_settingsController.navigationController popViewControllerAnimated:NO];
}];
[alert show];
- } else if ([key isEqual:@"about_button"]) {
- [PhoneMainView.instance changeCurrentView:AboutView.compositeViewDescription];
} else if ([key isEqual:@"reset_logs_button"]) {
linphone_core_reset_log_collection();
} else if ([key isEqual:@"send_logs_button"]) {
diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m
index 1c93ba76b..de3a8dc2d 100644
--- a/Classes/Utils/Log.m
+++ b/Classes/Utils/Log.m
@@ -19,7 +19,7 @@
#import "Log.h"
-@implementation LinphoneLogger
+@implementation Log
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ... {
va_list args;
@@ -28,45 +28,59 @@
const char *utf8str = [str cStringUsingEncoding:NSString.defaultCStringEncoding];
int filesize = 20;
const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
- if (severity <= ORTP_DEBUG) {
- // lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even
- // not in debug build...
- ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
- } else {
- ortp_log(severity, "%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
- utf8str);
+
+ char levelC = 'U'; // undefined
+ if ((severity & ORTP_FATAL) != 0) {
+ levelC = 'F';
+ } else if ((severity & ORTP_ERROR) != 0) {
+ levelC = 'E';
+ } else if ((severity & ORTP_WARNING) != 0) {
+ levelC = 'W';
+ } else if ((severity & ORTP_MESSAGE) != 0) {
+ levelC = 'I';
+ } else if (((severity & ORTP_TRACE) != 0) || ((severity & ORTP_DEBUG) != 0)) {
+ levelC = 'D';
}
+ // we want application logs to be always enabled so use | ORTP_ERROR extra mask
+ ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize,
+ filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
va_end(args);
}
++ (void)enableLogs:(BOOL)enabled {
+ [LinphoneManager.instance lpConfigSetBool:enabled forKey:@"debugenable_preference"];
+ linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
+ if (enabled) {
+ NSLog(@"Enabling debug logs");
+ linphone_core_set_log_level(ORTP_DEBUG);
+ } else {
+ NSLog(@"Disabling debug logs");
+ linphone_core_set_log_level(ORTP_ERROR);
+ }
+ linphone_core_enable_log_collection(enabled);
+}
+
#pragma mark - Logs Functions callbacks
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
NSString *format = [[NSString alloc] initWithUTF8String:fmt];
NSString *formatedString = [[NSString alloc] initWithFormat:format arguments:args];
- char levelC = 'I';
- switch ((OrtpLogLevel)lev) {
- case ORTP_FATAL:
- levelC = 'F';
- break;
- case ORTP_ERROR:
- levelC = 'E';
- break;
- case ORTP_WARNING:
- levelC = 'W';
- break;
- case ORTP_MESSAGE:
- levelC = 'I';
- break;
- case ORTP_TRACE:
- case ORTP_DEBUG:
- levelC = 'D';
- break;
- case ORTP_LOGLEV_END:
- return;
+ NSString *lvl = @"";
+ if ((lev & APP_LVL) == 0) {
+ if ((lev & ORTP_FATAL) != 0) {
+ lvl = @"F ";
+ } else if ((lev & ORTP_ERROR) != 0) {
+ lvl = @"E ";
+ } else if ((lev & ORTP_WARNING) != 0) {
+ lvl = @"W ";
+ } else if ((lev & ORTP_MESSAGE) != 0) {
+ lvl = @"I ";
+ } else if (((lev & ORTP_TRACE) != 0) || ((lev & ORTP_DEBUG) != 0)) {
+ lvl = @"D ";
+ }
}
- // since \r are interpreted like \n, avoid double new lines when logging packets
- NSLog(@"%c %@", levelC, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]);
+ // since \r are interpreted like \n, avoid double new lines when logging network packets (belle-sip)
+ NSLog(@"%@%@", lvl, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]);
}
@end
diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist
index 30e709696..f37c4fd13 100644
--- a/Settings/InAppSettings.bundle/Root.plist
+++ b/Settings/InAppSettings.bundle/Root.plist
@@ -150,22 +150,6 @@
Type
PSGroupSpecifier
-
- Key
- about_button
- Title
- About
- Type
- IASKButtonSpecifier
-
-
- Key
- quit_button
- Title
- Quit
- Type
- IASKButtonSpecifier
-
Key
release_button
diff --git a/TestsUI/LinphoneTestCase.m b/TestsUI/LinphoneTestCase.m
index cb2deb163..371ef2365 100644
--- a/TestsUI/LinphoneTestCase.m
+++ b/TestsUI/LinphoneTestCase.m
@@ -48,6 +48,7 @@
- (void)beforeEach {
[[LinphoneManager instance] lpConfigSetInt:NO forKey:@"animations_preference"];
+ linphone_core_set_log_level(ORTP_MESSAGE);
}
- (NSString *)me {
diff --git a/submodules/linphone b/submodules/linphone
index 454e9834a..67f9bd206 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 454e9834aed36270db6cdf2e4ca7240713dcf930
+Subproject commit 67f9bd2068ab6d040ddadd4209a538aef99a893a