9 releases
0.1.9 | Sep 29, 2024 |
---|---|
0.1.8 | Aug 11, 2024 |
0.1.1 | Apr 17, 2024 |
#444 in Debugging
31KB
699 lines
th plugin logger base on tracing
Add follow to your Cargo.toml which project build the lib_my_th_plugin.so
tracing = "0.1"
tracing-th = "0.1"
tracing-subscriber = "0.3"
Use it in Global Object
init
unsafe extern "C" fn init_(_: *mut c_void, common: *const ThCommon, err_out: *mut c_char, err_out_max: usize) -> c_int {
if common.is_null() {
return 1;
}
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
let layer = tracing_th::builder::ThLayer::builder().common(common.cast()).build().expect("Build th logger as tracing layer fail");
tracing_subscriber::registry().with(layer).init();
todo!()
}
Dependencies
~3.5–6.5MB
~130K SLoC