Compare commits

...

2 commits

Author SHA1 Message Date
Matthew Yung 4735adcb66
fixed issue with tag assign mode (#2570) 2024-06-26 20:35:53 +00:00
Arnab Chakraborty aaf1f237cd
[MOB-72] Tracing logs not working on Android (#2569)
* Logging to logcat instead of logfile

Hopefully works now?

* Lock dep for Android builds only

* Don't want only debug logs lol

* Update lib.rs
2024-06-26 20:20:16 +00:00
4 changed files with 33 additions and 5 deletions

18
Cargo.lock generated
View file

@ -132,6 +132,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_log-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e"
[[package]]
name = "android_system_properties"
version = "0.1.5"
@ -9024,6 +9030,7 @@ dependencies = [
"tokio-util",
"tower-service",
"tracing",
"tracing-android",
"tracing-appender",
"tracing-subscriber",
"tracing-test",
@ -11239,6 +11246,17 @@ dependencies = [
"tracing-core",
]
[[package]]
name = "tracing-android"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12612be8f868a09c0ceae7113ff26afe79d81a24473a393cb9120ece162e86c0"
dependencies = [
"android_log-sys",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "tracing-appender"
version = "0.2.3"

View file

@ -159,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 }

View file

@ -31,7 +31,7 @@ use tracing_appender::{
non_blocking::{NonBlocking, WorkerGuard},
rolling::{RollingFileAppender, Rotation},
};
use tracing_subscriber::{filter::FromEnvError, prelude::*, EnvFilter};
use tracing_subscriber::{filter::FromEnvError, prelude::*, registry, EnvFilter};
pub mod api;
mod cloud;
@ -254,12 +254,15 @@ impl Node {
);
}
tracing_subscriber::registry()
let registry = registry();
let registry = registry
.with(
tracing_subscriber::fmt::layer()
.with_file(true)
.with_line_number(true)
.with_ansi(false)
.with_target(true)
.with_writer(logfile)
.with_filter(EnvFilter::from_default_env()),
)
@ -269,8 +272,12 @@ impl Node {
.with_line_number(true)
.with_writer(std::io::stdout)
.with_filter(EnvFilter::from_default_env()),
)
.init();
);
#[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| {
use std::backtrace::{Backtrace, BacktraceStatus};

View file

@ -154,7 +154,7 @@ export const ExplorerTagBar = () => {
// extract the list of tags from each object in the selected items
const targetsTagList = Array.from(explorer.selectedItems.entries()).map(
// issues with type here. unsure as to why, and not causing any noticeable errors, so ignoring for now with as any
(item) => (item[0] as any).object.item.tags
(item) => (item[0] as any).item.object.tags
);
// iterate through each tag in the selected items and check if the tag we want to assign is already assigned