Use set_log_message_callback in Java example.

This commit is contained in:
levlam 2021-05-18 16:36:11 +03:00
parent e31ec28c30
commit 9ad1b3b49a

View File

@ -101,7 +101,10 @@ static constexpr jint JAVA_VERSION = JNI_VERSION_1_6;
static JavaVM *java_vm;
static jclass log_class;
static void on_fatal_error(const char *error_message) {
static void on_log_message(int verbosity_level, const char *error_message) {
if (verbosity_level != 0) {
return;
}
auto env = td::jni::get_jni_env(java_vm, JAVA_VERSION);
if (env == nullptr) {
return;
@ -154,7 +157,7 @@ static jint register_native(JavaVM *vm) {
td::jni::init_vars(env, PACKAGE_NAME);
td::td_api::Object::init_jni_vars(env, PACKAGE_NAME);
td::td_api::Function::init_jni_vars(env, PACKAGE_NAME);
td::Log::set_fatal_error_callback(on_fatal_error);
td::ClientManager::set_log_message_callback(0, on_log_message);
return JAVA_VERSION;
}