From ebc78f442b317ab5cd307ad87524374ffaa2c881 Mon Sep 17 00:00:00 2001 From: Arnab Chakraborty <11457760+Rocky43007@users.noreply.github.com> Date: Thu, 27 Jun 2024 01:19:48 +0530 Subject: [PATCH] Lock dep for Android builds only --- Cargo.toml | 1 - core/Cargo.toml | 4 +++- core/src/lib.rs | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3e1192ba4..349d571ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,6 @@ tokio = "1.38" tokio-stream = "0.1.15" tokio-util = "0.7.11" tracing = "0.1.40" -tracing-android = "0.2.0" tracing-subscriber = "0.3.18" tracing-test = "0.2.5" uhlc = "0.6.0" # Must follow version used by specta diff --git a/core/Cargo.toml b/core/Cargo.toml index 31bf486c8..3d411853e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -102,7 +102,6 @@ tokio = { workspace = true, features = [ tokio-stream = { workspace = true, features = ["fs"] } tokio-util = { workspace = true, features = ["io"] } tracing = { workspace = true } -tracing-android = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } uuid = { workspace = true, features = ["v4", "serde"] } webp = { workspace = true } @@ -160,6 +159,9 @@ icrate = { version = "0.1.2", features = [ "Foundation_NSNumber", ] } +[target.'cfg(target_os = "android")'.dependencies] +tracing-android = "0.2.0" + [dev-dependencies] # Workspace dependencies globset = { workspace = true } diff --git a/core/src/lib.rs b/core/src/lib.rs index ce4d3dc8e..726eeec7c 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -258,16 +258,14 @@ impl Node { let registry = registry(); - #[cfg(target_os = "android")] - let registry = registry.with(tracing_android::layer("com.spacedrive.app").unwrap()); - let registry = registry .with( tracing_subscriber::fmt::layer() .with_file(true) .with_line_number(true) .with_ansi(false) - // .with_writer(logfile) + .with_target(false) + .with_writer(logfile) .with_filter(EnvFilter::from_default_env()), ) .with( @@ -278,6 +276,9 @@ impl Node { .with_filter(EnvFilter::from_default_env()), ); + #[cfg(target_os = "android")] + let registry = registry.with(tracing_android::layer("com.spacedrive.app").unwrap()); + registry.init(); std::panic::set_hook(Box::new(move |panic| {