threefoldtech/mycelium

android: add timestamp on the log

iwanbk opened this issue · 1 comments

There is currently no timestamp in the android log which will hep to debug connectivity issue.

Have tried this changes (and similar changes) with no result

diff --git a/mobile/src/lib.rs b/mobile/src/lib.rs
index f21b28a..d31d82d 100644
--- a/mobile/src/lib.rs
+++ b/mobile/src/lib.rs
@@ -13,12 +13,15 @@ use tokio::sync::{mpsc, Mutex};
 fn setup_logging() {
     use tracing::level_filters::LevelFilter;
     use tracing_subscriber::filter::Targets;
+    use tracing_subscriber::fmt;
+    use tracing_subscriber::fmt::time::ChronoLocal;
     use tracing_subscriber::layer::SubscriberExt;
     use tracing_subscriber::util::SubscriberInitExt;
     let targets = Targets::new()
         .with_default(LevelFilter::INFO)
         .with_target("mycelium::router", LevelFilter::WARN);
     tracing_subscriber::registry()
+        .with(fmt::layer().with_timer(ChronoLocal::default()))
         .with(tracing_android::layer("mycelium").expect("failed to setup logger"))
         .with(targets)
         .init();

There are currently 3 ways to get the log: vscode debug console, adb, and android studio.

adb and android studio already show the timestamp, so i think we don't need it.