summaryrefslogtreecommitdiff
path: root/java/jni
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-04-25 20:46:56 -0700
committerGrant Limberg <glimberg@gmail.com>2015-04-25 20:46:56 -0700
commit3bdbc6390f0618348dc37ce586c195ac1434f2b7 (patch)
treeb87303544ae1e9ca4bbd447d90b570284948cc6c /java/jni
parent8a09e0ec3cb2f37b395cae5c78264e99b5471183 (diff)
downloadinfinitytier-3bdbc6390f0618348dc37ce586c195ac1434f2b7.tar.gz
infinitytier-3bdbc6390f0618348dc37ce586c195ac1434f2b7.zip
Added logging to Android logcat
Diffstat (limited to 'java/jni')
-rw-r--r--java/jni/Android.mk1
-rw-r--r--java/jni/ZT1_jniutils.h13
2 files changed, 14 insertions, 0 deletions
diff --git a/java/jni/Android.mk b/java/jni/Android.mk
index 136b6c81..367900e6 100644
--- a/java/jni/Android.mk
+++ b/java/jni/Android.mk
@@ -4,6 +4,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := ZeroTierOneJNI
LOCAL_C_INCLUDES := $(ZT1)/include
+LOCAL_LDLIBS := -llog
# ZeroTierOne SDK source files
LOCAL_SRC_FILES := \
diff --git a/java/jni/ZT1_jniutils.h b/java/jni/ZT1_jniutils.h
index a379ed05..4c7a69bf 100644
--- a/java/jni/ZT1_jniutils.h
+++ b/java/jni/ZT1_jniutils.h
@@ -7,6 +7,19 @@
extern "C" {
#endif
+#define LOG_TAG "ZeroTierOneJNI"
+
+#if __ANDROID__
+#include <android/log.h>
+#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
+#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
+#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
+#else
+#define LOGI(...)
+#define LOGD(...)
+#define LOGE(...)
+#endif
+
jobject createResultObject(JNIEnv *env, ZT1_ResultCode code);
jobject createVirtualNetworkStatus(JNIEnv *env, ZT1_VirtualNetworkStatus status);
jobject createVirtualNetworkType(JNIEnv *env, ZT1_VirtualNetworkType type);