]> sjero.net Git - linphone/commitdiff
TAG for android traces can be specified through JNI interface
authorSylvain Berfini <sylvain.berfini@belledonne-communications.com>
Thu, 27 Dec 2012 11:18:02 +0000 (12:18 +0100)
committerSylvain Berfini <sylvain.berfini@belledonne-communications.com>
Thu, 27 Dec 2012 11:18:02 +0000 (12:18 +0100)
build/android/common.mk
coreapi/linphonecore_jni.cc
java/common/org/linphone/core/LinphoneCoreFactory.java
java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java

index 99e1787a752ff4f7381cfb8a7bf714a04155e8bf..d629b54afab32e04f400ad32706a509e3cd70768 100644 (file)
@@ -46,10 +46,6 @@ LOCAL_SRC_FILES := \
        ec-calibrator.c \
        linphone_tunnel.cc
 
-ifndef MY_LOG_DOMAIN
-MY_LOG_DOMAIN = \"Linphone\"
-endif
-
 ifndef LINPHONE_VERSION
 LINPHONE_VERSION = "Devel"
 endif
@@ -64,7 +60,6 @@ LOCAL_CFLAGS += \
        -DENABLE_TRACE \
        -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \
        -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \
-       -DLOG_DOMAIN=$(MY_LOG_DOMAIN) \
        -DHAVE_EXOSIP_TRYLOCK=1 \
        -DHAVE_EXOSIP_TLS_VERIFY_CERTIFICATE=1 
 
index 5bdcbfe339f83d8a410af448d44ee0dbf1932599..102d2177799cafc509a1d2daafdc297be426bb11 100644 (file)
@@ -52,6 +52,7 @@ extern "C" void libmsbcg729_init();
 #endif /*ANDROID*/
 
 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){
@@ -70,15 +71,15 @@ static void linphone_android_log_handler(OrtpLogLevel lev, const char *fmt, va_l
        vsnprintf(str, sizeof(str) - 1, fmt, args);
        str[sizeof(str) - 1] = '\0';
        if (strlen(str) < 512) {
-               __android_log_write(prio, LOG_DOMAIN, str);
+               __android_log_write(prio, LogDomain, str);
        } else {
                current = str;
                while ((next = strchr(current, '\n')) != NULL) {
                        *next = '\0';
-                       __android_log_write(prio, LOG_DOMAIN, current);
+                       __android_log_write(prio, LogDomain, current);
                        current = next + 1;
                }
-               __android_log_write(prio, LOG_DOMAIN, current);
+               __android_log_write(prio, LogDomain, current);
        }
 }
 
@@ -100,8 +101,10 @@ JNIEXPORT jint JNICALL  JNI_OnLoad(JavaVM *ajvm, void *reserved)
 //LinphoneFactory
 extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIEnv*  env
                ,jobject  thiz
-               ,jboolean isDebug) {
+               ,jboolean isDebug
+               ,jstring  jdebugTag) {
        if (isDebug) {
+               LogDomain = env->GetStringUTFChars(jdebugTag, NULL);
                linphone_core_enable_logs_with_cb(linphone_android_log_handler);
        } else {
                linphone_core_disable_logs();
index 04cef4aea24b3bf709e3aa5feef01e11b80fe6da..1007940164911d80d92ad57d98844b7fa96304cb 100644 (file)
@@ -72,8 +72,9 @@ abstract public class LinphoneCoreFactory {
        /**
         * Enable verbose traces
         * @param enable 
+        * @param tag
         */
-       abstract public  void setDebugMode(boolean enable);
+       abstract public  void setDebugMode(boolean enable, String tag);
        
        abstract public void setLogHandler(LinphoneLogHandler handler);
        /**
index a99509fa38ef5c5c44f39f9229098a56297103a6..b719f0f7060cc02c975eb95d3a541809db9608cc 100644 (file)
@@ -131,7 +131,7 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
        }
 
        @Override
-       public native void setDebugMode(boolean enable);
+       public native void setDebugMode(boolean enable, String tag);
 
        @Override
        public void setLogHandler(LinphoneLogHandler handler) {