Skip to content

Commit

Permalink
Fix ffi Binding logger errors (#1664)
Browse files Browse the repository at this point in the history
* add some log to the logger

* more tweaks

* cargo fmt
  • Loading branch information
nplasterer authored Feb 25, 2025
1 parent c7728fa commit 64d7371
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions bindings_ffi/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ mod android {
{
use tracing_subscriber::EnvFilter;
let api_calls_filter = EnvFilter::builder().parse_lossy("xmtp_api=debug");
let libxmtp_filter = EnvFilter::builder().parse(FILTER_DIRECTIVE);
let libxmtp_filter = EnvFilter::builder()
.parse(FILTER_DIRECTIVE)
.unwrap_or_else(|_| EnvFilter::new("info"));

vec![
paranoid_android::layer(env!("CARGO_PKG_NAME"))
.with_thread_names(true)
Expand All @@ -38,14 +41,19 @@ pub use ios::*;
#[cfg(target_os = "ios")]
mod ios {
use super::*;
// use tracing_subscriber::Layer;
use tracing_oslog::OsLogger;
use tracing_subscriber::EnvFilter;

pub fn native_layer<S>() -> impl Layer<S>
where
S: Subscriber + for<'a> LookupSpan<'a>,
{
use tracing_oslog::OsLogger;
let libxmtp_filter = EnvFilter::builder().parse(FILTER_DIRECTIVE);
let libxmtp_filter = EnvFilter::builder()
.parse(FILTER_DIRECTIVE)
.unwrap_or_else(|_| EnvFilter::new("info"));

let subsystem = format!("org.xmtp.{}", env!("CARGO_PKG_NAME"));

OsLogger::new(subsystem, "default").with_filter(libxmtp_filter)
}
}
Expand Down

0 comments on commit 64d7371

Please sign in to comment.