Java API - Add missing HEADER_LEVEL logging (#1104)

This commit is contained in:
Adam Retter 2016-05-06 18:06:12 -04:00 committed by Yueh-Hsuan Chiang
parent 4d02bfa3a6
commit 72c73cdc8b
3 changed files with 12 additions and 3 deletions

View File

@ -60,6 +60,9 @@ void LoggerJniCallback::Logv(const InfoLogLevel log_level,
case rocksdb::InfoLogLevel::FATAL_LEVEL:
jlog_level = InfoLogLevelJni::FATAL_LEVEL(env);
break;
case rocksdb::InfoLogLevel::HEADER_LEVEL:
jlog_level = InfoLogLevelJni::HEADER_LEVEL(env);
break;
default:
jlog_level = InfoLogLevelJni::FATAL_LEVEL(env);
break;

View File

@ -676,15 +676,20 @@ class InfoLogLevelJni {
return getEnum(env, "FATAL_LEVEL");
}
// Get the HEADER_LEVEL enum field of org.rocksdb.InfoLogLevel
static jobject HEADER_LEVEL(JNIEnv* env) {
return getEnum(env, "HEADER_LEVEL");
}
private:
// Get the java class id of org.rocksdb.WBWIRocksIterator.WriteType.
// Get the java class id of org.rocksdb.InfoLogLevel
static jclass getJClass(JNIEnv* env) {
jclass jclazz = env->FindClass("org/rocksdb/InfoLogLevel");
assert(jclazz != nullptr);
return jclazz;
}
// Get an enum field of org.rocksdb.WBWIRocksIterator.WriteType
// Get an enum field of org.rocksdb.InfoLogLevel
static jobject getEnum(JNIEnv* env, const char name[]) {
jclass jclazz = getJClass(env);
jfieldID jfid =

View File

@ -9,7 +9,8 @@ public enum InfoLogLevel {
WARN_LEVEL((byte)2),
ERROR_LEVEL((byte)3),
FATAL_LEVEL((byte)4),
NUM_INFO_LOG_LEVELS((byte)5);
HEADER_LEVEL((byte)5),
NUM_INFO_LOG_LEVELS((byte)6);
private final byte value_;