增加日志输出内容

This commit is contained in:
lbl8603
2024-05-10 23:19:52 +08:00
parent 9df324f402
commit 0e4294415e
7 changed files with 90 additions and 17 deletions
+1
View File
@@ -2,3 +2,4 @@ pub mod callback;
pub mod config;
pub mod utils;
pub mod vnt;
pub(crate) mod vnt_logger;
+1 -1
View File
@@ -11,7 +11,6 @@ use vnt::core::Vnt;
use vnt::handle::PeerDeviceInfo;
use crate::callback::CallBack;
#[no_mangle]
pub unsafe extern "C" fn Java_top_wherewego_vnt_jni_Vnt_new0(
mut env: JNIEnv<'static>,
@@ -19,6 +18,7 @@ pub unsafe extern "C" fn Java_top_wherewego_vnt_jni_Vnt_new0(
config: JObject,
call_back: JObject<'static>,
) -> jlong {
crate::vnt_logger::init_log();
let jvm = if let Ok(jvm) = env.get_java_vm() {
jvm
} else {
+12
View File
@@ -0,0 +1,12 @@
#[cfg(target_os = "android")]
pub fn init_log() {
use android_logger::Config;
use log::LevelFilter;
android_logger::init_once(
Config::default()
.with_max_level(LevelFilter::Info) // limit log level
.with_tag("vnt_jni"), // logs will show under mytag tag
);
}
#[cfg(not(target_os = "android"))]
pub fn init_log() {}