android: fix android logging
This commit is contained in:
@@ -44,7 +44,7 @@ default = []
|
||||
profiling = ["notedeck_columns/puffin", "puffin", "puffin_egui"]
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
android_logger = "0.11.1"
|
||||
tracing-logcat = "0.1.0"
|
||||
log = { workspace = true }
|
||||
android-activity = { version = "0.4", features = [ "native-activity" ] }
|
||||
winit = { version = "0.30.5", features = [ "android-native-activity" ] }
|
||||
|
||||
@@ -9,8 +9,31 @@ use winit::platform::android::EventLoopBuilderExtAndroid;
|
||||
#[no_mangle]
|
||||
#[tokio::main]
|
||||
pub async fn android_main(app: AndroidApp) {
|
||||
use tracing_logcat::{LogcatMakeWriter, LogcatTag};
|
||||
use tracing_subscriber::{prelude::*, EnvFilter};
|
||||
|
||||
std::env::set_var("RUST_BACKTRACE", "full");
|
||||
android_logger::init_once(android_logger::Config::default().with_min_level(log::Level::Info));
|
||||
std::env::set_var(
|
||||
"RUST_LOG",
|
||||
"enostr=debug,notedeck_columns=debug,notedeck_chrome=debug",
|
||||
);
|
||||
|
||||
let writer =
|
||||
LogcatMakeWriter::new(LogcatTag::Target).expect("Failed to initialize logcat writer");
|
||||
|
||||
let fmt_layer = tracing_subscriber::fmt::layer()
|
||||
.with_level(false)
|
||||
.with_target(false)
|
||||
.without_time();
|
||||
|
||||
let filter_layer = EnvFilter::try_from_default_env()
|
||||
.or_else(|_| EnvFilter::try_new("info"))
|
||||
.unwrap();
|
||||
|
||||
tracing_subscriber::registry()
|
||||
.with(filter_layer)
|
||||
.with(fmt_layer)
|
||||
.init();
|
||||
|
||||
let path = app.internal_data_path().expect("data path");
|
||||
let mut options = eframe::NativeOptions::default();
|
||||
|
||||
@@ -23,7 +23,6 @@ egui_tabs = { workspace = true }
|
||||
egui_virtual_list = { workspace = true }
|
||||
ehttp = { workspace = true }
|
||||
enostr = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
image = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
|
||||
Reference in New Issue
Block a user