mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 04:28:10 +00:00
Fix logging for tunnel on Android.
This commit is contained in:
parent
6799a424ae
commit
8de31757c6
2 changed files with 25 additions and 19 deletions
|
|
@ -355,7 +355,8 @@ void TunnelManager::sOnIterate(TunnelManager *zis){
|
|||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
static void linphone_android_log_handler(int lev, const char *fmt, va_list args){
|
||||
extern void linphone_android_log_handler(int prio, const char *fmt, va_list args);
|
||||
static void linphone_android_tunnel_log_handler(int lev, const char *fmt, va_list args) {
|
||||
int prio;
|
||||
switch(lev){
|
||||
case TUNNEL_DEBUG: prio = ANDROID_LOG_DEBUG; break;
|
||||
|
|
@ -363,9 +364,9 @@ static void linphone_android_log_handler(int lev, const char *fmt, va_list args)
|
|||
case TUNNEL_NOTICE: prio = ANDROID_LOG_INFO; break;
|
||||
case TUNNEL_WARN: prio = ANDROID_LOG_WARN; break;
|
||||
case TUNNEL_ERROR: prio = ANDROID_LOG_ERROR; break;
|
||||
default: prio = ANDROID_LOG_DEFAULT; break;
|
||||
default: prio = ANDROID_LOG_DEFAULT; break;
|
||||
}
|
||||
__android_log_vprint(prio, LOG_DOMAIN, fmt, args);
|
||||
linphone_android_log_handler(prio, fmt, args);
|
||||
}
|
||||
#endif /*ANDROID*/
|
||||
|
||||
|
|
@ -376,7 +377,7 @@ void TunnelManager::enableLogs(bool value) {
|
|||
void TunnelManager::enableLogs(bool isEnabled,LogHandler logHandler) {
|
||||
if (logHandler != NULL) SetLogHandler(logHandler);
|
||||
#ifdef ANDROID
|
||||
else SetLogHandler(linphone_android_log_handler);
|
||||
else SetLogHandler(linphone_android_tunnel_log_handler);
|
||||
#else
|
||||
else SetLogHandler(default_log_handler);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -55,22 +55,14 @@ static JavaVM *jvm=0;
|
|||
static const char* LogDomain = "Linphone";
|
||||
|
||||
#ifdef ANDROID
|
||||
static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
|
||||
int prio;
|
||||
char str[4096];
|
||||
void linphone_android_log_handler(int prio, const char *fmt, va_list args) {
|
||||
char str[4096];
|
||||
char *current;
|
||||
char *next;
|
||||
switch(lev){
|
||||
case ORTP_DEBUG: prio = ANDROID_LOG_DEBUG; break;
|
||||
case ORTP_MESSAGE: prio = ANDROID_LOG_INFO; break;
|
||||
case ORTP_WARNING: prio = ANDROID_LOG_WARN; break;
|
||||
case ORTP_ERROR: prio = ANDROID_LOG_ERROR; break;
|
||||
case ORTP_FATAL: prio = ANDROID_LOG_FATAL; break;
|
||||
default: prio = ANDROID_LOG_DEFAULT; break;
|
||||
}
|
||||
vsnprintf(str, sizeof(str) - 1, fmt, args);
|
||||
str[sizeof(str) - 1] = '\0';
|
||||
if (strlen(str) < 512) {
|
||||
|
||||
vsnprintf(str, sizeof(str) - 1, fmt, args);
|
||||
str[sizeof(str) - 1] = '\0';
|
||||
if (strlen(str) < 512) {
|
||||
__android_log_write(prio, LogDomain, str);
|
||||
} else {
|
||||
current = str;
|
||||
|
|
@ -83,6 +75,19 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l
|
|||
}
|
||||
}
|
||||
|
||||
static void linphone_android_ortp_log_handler(OrtpLogLevel lev, const char *fmt, va_list args) {
|
||||
int prio;
|
||||
switch(lev){
|
||||
case ORTP_DEBUG: prio = ANDROID_LOG_DEBUG; break;
|
||||
case ORTP_MESSAGE: prio = ANDROID_LOG_INFO; break;
|
||||
case ORTP_WARNING: prio = ANDROID_LOG_WARN; break;
|
||||
case ORTP_ERROR: prio = ANDROID_LOG_ERROR; break;
|
||||
case ORTP_FATAL: prio = ANDROID_LOG_FATAL; break;
|
||||
default: prio = ANDROID_LOG_DEFAULT; break;
|
||||
}
|
||||
linphone_android_log_handler(prio, fmt, args);
|
||||
}
|
||||
|
||||
int dumbMethodForAllowingUsageOfCpuFeaturesFromStaticLibMediastream() {
|
||||
return (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM && (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0);
|
||||
}
|
||||
|
|
@ -105,7 +110,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIE
|
|||
,jstring jdebugTag) {
|
||||
if (isDebug) {
|
||||
LogDomain = env->GetStringUTFChars(jdebugTag, NULL);
|
||||
linphone_core_enable_logs_with_cb(linphone_android_log_handler);
|
||||
linphone_core_enable_logs_with_cb(linphone_android_ortp_log_handler);
|
||||
} else {
|
||||
linphone_core_disable_logs();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue