summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2018-02-07 15:53:14 -0800
committerGrant Limberg <grant.limberg@zerotier.com>2018-02-07 15:53:23 -0800
commitf049740ae567fd4f4c855766869beb905b226a9b (patch)
treed96505df78bd406f4e7b1200b0aecbaeca5baeef /java
parentc6949aad2ddacf36f191bbda58450ae57d9c59c3 (diff)
downloadinfinitytier-f049740ae567fd4f4c855766869beb905b226a9b.tar.gz
infinitytier-f049740ae567fd4f4c855766869beb905b226a9b.zip
silence LOGV and LOGD in release builds for android
Diffstat (limited to 'java')
-rw-r--r--java/jni/ZT_jniutils.h32
1 files changed, 23 insertions, 9 deletions
diff --git a/java/jni/ZT_jniutils.h b/java/jni/ZT_jniutils.h
index e35d4f42..56b63179 100644
--- a/java/jni/ZT_jniutils.h
+++ b/java/jni/ZT_jniutils.h
@@ -28,17 +28,31 @@ extern "C" {
#define LOG_TAG "ZeroTierOneJNI"
-#if __ANDROID__
+#if defined(__ANDROID__)
+
#include <android/log.h>
-#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
-#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__))
+
+ #if !defined(NDEBUG)
+ #define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
+ #define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
+ #else
+ #define LOGV(...)
+ #define LOGD(...)
+ #endif
+
+ #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
+ #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
#else
-#define LOGV(...) fprintf(stdout, __VA_ARGS__)
-#define LOGI(...) fprintf(stdout, __VA_ARGS__)
-#define LOGD(...) fprintf(stdout, __VA_ARGS__)
-#define LOGE(...) fprintf(stdout, __VA_ARGS__)
+ #if !defined(NDEBUG)
+ #define LOGV(...) fprintf(stdout, __VA_ARGS__)
+ #define LOGD(...) fprintf(stdout, __VA_ARGS__)
+ #else
+ #define LOGV(...)
+ #define LOGD(...)
+ #endif
+
+ #define LOGI(...) fprintf(stdout, __VA_ARGS__)
+ #define LOGE(...) fprintf(stdout, __VA_ARGS__)
#endif
jobject createResultObject(JNIEnv *env, ZT_ResultCode code);