Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor C4Log to use proxy #78

Merged
merged 2 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Refactoring c4logs to have proxy. Comment out LogTest for now to avoi…
…d compile error.
  • Loading branch information
LaurenNguyen14 committed May 11, 2022
commit 75bfd2effde3be5974211bca6728acba49f11298
69 changes: 0 additions & 69 deletions common/main/cpp/com_couchbase_lite_internal_core_C4Log.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include <jni.h>
/* Header for class com_couchbase_lite_internal_core_impl_NativeC4Log */

#ifndef _Included_com_couchbase_lite_internal_core_impl_NativeC4Log
#define _Included_com_couchbase_lite_internal_core_impl_NativeC4Log
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: log
* Signature: (Ljava/lang/String;ILjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_log
(JNIEnv *, jclass, jstring, jint, jstring);

/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: getBinaryFileLevel
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_getBinaryFileLevel
(JNIEnv *, jclass);

/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: setBinaryFileLevel
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_setBinaryFileLevel
(JNIEnv *, jclass, jint);

/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: writeToBinaryFile
* Signature: (Ljava/lang/String;IIJZLjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_writeToBinaryFile
(JNIEnv *, jclass, jstring, jint, jint, jlong, jboolean, jstring);

/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: getLevel
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_getLevel
(JNIEnv *, jclass, jstring);

/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: setCallbackLevel
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_setCallbackLevel
(JNIEnv *, jclass, jint);

/*
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: setLevel
* Signature: (Ljava/lang/String;I)V
*/
JNIEXPORT void JNICALL Java_com_couchbase_lite_internal_core_impl_NativeC4Log_setLevel
(JNIEnv *, jclass, jstring, jint);

#ifdef __cplusplus
}
#endif
#endif
30 changes: 15 additions & 15 deletions common/main/cpp/native_c4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#endif

#include "com_couchbase_lite_internal_core_C4.h"
#include "com_couchbase_lite_internal_core_C4Log.h"
#include "com_couchbase_lite_internal_core_impl_NativeC4Log.h"
#include "com_couchbase_lite_internal_core_C4Key.h"
#include "native_glue.hh"

Expand Down Expand Up @@ -209,19 +209,19 @@ Java_com_couchbase_lite_internal_core_C4_getVersion(JNIEnv *env, jclass ignore)
// com_couchbase_lite_internal_core_C4Log
// ----------------------------------------------------------------------------
/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: getLevel
* Signature: (Ljava/lang/String;I)V
*/
JNIEXPORT jint JNICALL
Java_com_couchbase_lite_internal_core_C4Log_getLevel(JNIEnv *env, jclass ignore, jstring jdomain) {
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_getLevel(JNIEnv *env, jclass ignore, jstring jdomain) {
jstringSlice domain(env, jdomain);
C4LogDomain logDomain = c4log_getDomain(domain.c_str(), false);
return (!logDomain) ? -1 : (jint) c4log_getLevel(logDomain);
}

/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_C4Log
* Method: setLevel
* Signature: (Ljava/lang/String;I)V
*
Expand All @@ -232,7 +232,7 @@ Java_com_couchbase_lite_internal_core_C4Log_getLevel(JNIEnv *env, jclass ignore,
* that domain at any time, including before Core creates it.
*/
JNIEXPORT void JNICALL
Java_com_couchbase_lite_internal_core_C4Log_setLevel(
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_setLevel(
JNIEnv *env,
jclass ignore,
jstring jdomain,
Expand All @@ -243,12 +243,12 @@ Java_com_couchbase_lite_internal_core_C4Log_setLevel(
}

/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log_log
* Method: log
* Signature: (Ljava/lang/String;I;Ljava/lang/String)V
*/
JNIEXPORT void JNICALL
Java_com_couchbase_lite_internal_core_C4Log_log(
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_log(
JNIEnv *env,
jclass ignore,
jstring jdomain,
Expand All @@ -262,32 +262,32 @@ Java_com_couchbase_lite_internal_core_C4Log_log(
}

/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: getBinaryFileLevel
* Signature: (V)I
*/
JNIEXPORT jint JNICALL
Java_com_couchbase_lite_internal_core_C4Log_getBinaryFileLevel(JNIEnv *env, jclass ignore) {
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_getBinaryFileLevel(JNIEnv *env, jclass ignore) {
return c4log_binaryFileLevel();
}

/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: setBinaryFileLevel
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_com_couchbase_lite_internal_core_C4Log_setBinaryFileLevel(JNIEnv *env, jclass ignore, jint level) {
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_setBinaryFileLevel(JNIEnv *env, jclass ignore, jint level) {
c4log_setBinaryFileLevel((C4LogLevel) level);
}

/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: writeToBinaryFile
* Signature: (Ljava/lang/String;IIJZLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
Java_com_couchbase_lite_internal_core_C4Log_writeToBinaryFile(
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_writeToBinaryFile(
JNIEnv *env,
jclass ignore,
jstring jpath,
Expand All @@ -313,12 +313,12 @@ Java_com_couchbase_lite_internal_core_C4Log_writeToBinaryFile(
}

/*
* Class: com_couchbase_lite_internal_core_C4Log
* Class: com_couchbase_lite_internal_core_impl_NativeC4Log
* Method: setCallbackLevel
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_com_couchbase_lite_internal_core_C4Log_setCallbackLevel(JNIEnv *env, jclass clazz, jint jlevel) {
Java_com_couchbase_lite_internal_core_impl_NativeC4Log_setCallbackLevel(JNIEnv *env, jclass clazz, jint jlevel) {
c4log_setCallbackLevel((C4LogLevel) jlevel);
}

Expand Down
Loading