added the android verbose log level and moved most jni debug messages to verbose

This commit is contained in:
Grant Limberg 2015-05-26 21:31:34 -07:00
parent 9755dad7ff
commit 2d67196667
3 changed files with 10 additions and 8 deletions

View File

@ -36,7 +36,7 @@ JniCache::JniCache()
, m_methods() , m_methods()
, m_staticMethods() , m_staticMethods()
{ {
LOGD("JNI Cache Created"); LOGV("JNI Cache Created");
} }
JniCache::JniCache(JavaVM *jvm) JniCache::JniCache(JavaVM *jvm)
@ -47,12 +47,12 @@ JniCache::JniCache(JavaVM *jvm)
, m_methods() , m_methods()
, m_staticMethods() , m_staticMethods()
{ {
LOGD("JNI Cache Created"); LOGV("JNI Cache Created");
} }
JniCache::~JniCache() JniCache::~JniCache()
{ {
LOGD("JNI Cache Destroyed"); LOGV("JNI Cache Destroyed");
clearCache(); clearCache();
} }
@ -80,7 +80,7 @@ void JniCache::clearCache()
void JniCache::setJavaVM(JavaVM *jvm) void JniCache::setJavaVM(JavaVM *jvm)
{ {
LOGD("Assigned JVM to object"); LOGV("Assigned JVM to object");
m_jvm = jvm; m_jvm = jvm;
} }
@ -116,7 +116,7 @@ jclass JniCache::findClass(const std::string &name)
return cls; return cls;
} }
LOGD("Returning cached %s", name.c_str()); LOGV("Returning cached %s", name.c_str());
return found->second; return found->second;
} }

View File

@ -12,10 +12,12 @@ extern "C" {
#if __ANDROID__ #if __ANDROID__
#include <android/log.h> #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 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 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__)) #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
#else #else
#define LOGV(...) fprintf(stdout, __VA_ARGS__)
#define LOGI(...) fprintf(stdout, __VA_ARGS__) #define LOGI(...) fprintf(stdout, __VA_ARGS__)
#define LOGD(...) fprintf(stdout, __VA_ARGS__) #define LOGD(...) fprintf(stdout, __VA_ARGS__)
#define LOGE(...) fprintf(stdout, __VA_ARGS__) #define LOGE(...) fprintf(stdout, __VA_ARGS__)

View File

@ -324,7 +324,7 @@ namespace {
return -2; // couldn't create long[1] array return -2; // couldn't create long[1] array
} }
LOGD("Calling onDataStoreGet(%s, %p, %lu, %p)", LOGV("Calling onDataStoreGet(%s, %p, %lu, %p)",
objectName, buffer, bufferIndex, objectSizeObj); objectName, buffer, bufferIndex, objectSizeObj);
long retval = (long)env->CallLongMethod( long retval = (long)env->CallLongMethod(
@ -470,7 +470,7 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init( JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
JNIEnv *env, jobject obj, jlong now) JNIEnv *env, jobject obj, jlong now)
{ {
LOGD("Creating ZT1_Node struct"); LOGV("Creating ZT1_Node struct");
jobject resultObject = createResultObject(env, ZT1_RESULT_OK); jobject resultObject = createResultObject(env, ZT1_RESULT_OK);
ZT1_Node *node; ZT1_Node *node;
@ -604,7 +604,7 @@ JNIEXPORT jobject JNICALL Java_com_zerotier_sdk_Node_node_1init(
JNIEXPORT void JNICALL Java_com_zerotier_sdk_Node_node_1delete( JNIEXPORT void JNICALL Java_com_zerotier_sdk_Node_node_1delete(
JNIEnv *env, jobject obj, jlong id) JNIEnv *env, jobject obj, jlong id)
{ {
LOGD("Destroying ZT1_Node struct"); LOGV("Destroying ZT1_Node struct");
uint64_t nodeId = (uint64_t)id; uint64_t nodeId = (uint64_t)id;
NodeMap::iterator found = nodeMap.find(nodeId); NodeMap::iterator found = nodeMap.find(nodeId);