Introduce a new log file (ENABLE_JNI_LOG) to disable/enable logs in JNI side
This commit is contained in:
parent
8dbc2b50d5
commit
6348a45515
3 changed files with 18 additions and 10 deletions
|
@ -36,9 +36,12 @@ JNIEXPORT void OLM_INBOUND_GROUP_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *env
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGD(" ## releaseSessionJni(): sessionPtr=%p",sessionPtr);
|
LOGD(" ## releaseSessionJni(): sessionPtr=%p",sessionPtr);
|
||||||
|
#ifdef ENABLE_JNI_LOG
|
||||||
size_t retCode = olm_clear_inbound_group_session(sessionPtr);
|
size_t retCode = olm_clear_inbound_group_session(sessionPtr);
|
||||||
LOGI(" ## releaseSessionJni(): clear_inbound_group_session=%lu",static_cast<long unsigned int>(retCode));
|
LOGD(" ## releaseSessionJni(): clear_inbound_group_session=%lu",static_cast<long unsigned int>(retCode));
|
||||||
|
#else
|
||||||
|
olm_clear_inbound_group_session(sessionPtr);
|
||||||
|
#endif
|
||||||
|
|
||||||
LOGD(" ## releaseSessionJni(): free IN");
|
LOGD(" ## releaseSessionJni(): free IN");
|
||||||
free(sessionPtr);
|
free(sessionPtr);
|
||||||
|
@ -111,7 +114,7 @@ JNIEXPORT jint OLM_INBOUND_GROUP_SESSION_FUNC_DEF(initInboundGroupSessionWithSes
|
||||||
sessionResult = olm_init_inbound_group_session(sessionPtr, sessionKeyPtr, sessionKeyLength);
|
sessionResult = olm_init_inbound_group_session(sessionPtr, sessionKeyPtr, sessionKeyLength);
|
||||||
if(sessionResult == olm_error()) {
|
if(sessionResult == olm_error()) {
|
||||||
const char *errorMsgPtr = olm_inbound_group_session_last_error(sessionPtr);
|
const char *errorMsgPtr = olm_inbound_group_session_last_error(sessionPtr);
|
||||||
LOGE(" ## initInboundSessionFromIdKeyJni(): failure - init inbound session creation Msg=%s",errorMsgPtr);
|
LOGE(" ## initInboundSessionFromIdKeyJni(): failure - init inbound session creation Msg=%s",errorMsgPtr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,18 +28,19 @@
|
||||||
#define TAG "OlmJniNative"
|
#define TAG "OlmJniNative"
|
||||||
|
|
||||||
/* logging macros */
|
/* logging macros */
|
||||||
//#define ENABLE_LOGS
|
//#define ENABLE_JNI_LOG
|
||||||
|
|
||||||
#ifdef NDK_DEBUG
|
#ifdef NDK_DEBUG
|
||||||
#warning "NDK_DEBUG is defined"
|
#warning NDK_DEBUG is defined!
|
||||||
#else
|
#endif
|
||||||
#warning "NDK_DEBUG not defined"
|
|
||||||
|
#ifdef ENABLE_JNI_LOG
|
||||||
|
#warning ENABLE_JNI_LOG is defined!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
|
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
|
||||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
|
|
||||||
|
|
||||||
#ifdef NDK_DEBUG
|
#ifdef ENABLE_JNI_LOG
|
||||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
|
||||||
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
|
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -37,8 +37,12 @@ JNIEXPORT void OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(releaseSessionJni)(JNIEnv *en
|
||||||
{
|
{
|
||||||
LOGD(" ## releaseSessionJni(): sessionPtr=%p",sessionPtr);
|
LOGD(" ## releaseSessionJni(): sessionPtr=%p",sessionPtr);
|
||||||
|
|
||||||
|
#ifdef ENABLE_JNI_LOG
|
||||||
size_t retCode = olm_clear_outbound_group_session(sessionPtr);
|
size_t retCode = olm_clear_outbound_group_session(sessionPtr);
|
||||||
LOGI(" ## releaseSessionJni(): clear_outbound_group_session=%lu",static_cast<long unsigned int>(retCode));
|
LOGD(" ## releaseSessionJni(): clear_outbound_group_session=%lu",static_cast<long unsigned int>(retCode));
|
||||||
|
#else
|
||||||
|
olm_clear_outbound_group_session(sessionPtr);
|
||||||
|
#endif
|
||||||
|
|
||||||
LOGD(" ## releaseSessionJni(): free IN");
|
LOGD(" ## releaseSessionJni(): free IN");
|
||||||
free(sessionPtr);
|
free(sessionPtr);
|
||||||
|
|
Loading…
Reference in a new issue