diff --git a/aries_vcx/Cargo.toml b/aries_vcx/Cargo.toml index 703a53d4c7..e767c550ae 100644 --- a/aries_vcx/Cargo.toml +++ b/aries_vcx/Cargo.toml @@ -65,7 +65,6 @@ backtrace = { optional = true, version = "0.3" } [dev-dependencies] test_utils = { path = "../tools/test_utils" } -libvcx_logger = { path = "../tools/libvcx_logger" } wallet_migrator = { path = "../wallet_migrator" } async-channel = "1.7.1" tokio = { version = "1.20", features = ["rt", "macros", "rt-multi-thread"] } diff --git a/aries_vcx/tests/test_mysql_wallet.rs b/aries_vcx/tests/test_mysql_wallet.rs index f54ac90de9..f5b96a503e 100644 --- a/aries_vcx/tests/test_mysql_wallet.rs +++ b/aries_vcx/tests/test_mysql_wallet.rs @@ -13,12 +13,10 @@ mod dbtests { IndySdkWallet, WalletConfig, WalletConfigBuilder, }, }; - use libvcx_logger::LibvcxDefaultLogger; #[tokio::test] #[ignore] async fn test_mysql_init_issuer_with_mysql_wallet() -> Result<(), Box> { - LibvcxDefaultLogger::init_testing_logger(); let db_name = format!("mysqltest_{}", uuid::Uuid::new_v4()).replace('-', "_"); let storage_config = json!({ "read_host": "localhost", diff --git a/tools/libvcx_logger/Cargo.toml b/tools/libvcx_logger/Cargo.toml index 2d9568aca8..ce2236ddef 100644 --- a/tools/libvcx_logger/Cargo.toml +++ b/tools/libvcx_logger/Cargo.toml @@ -13,6 +13,3 @@ aries_vcx_core = { path = "../../aries_vcx_core" } chrono = "0.4" env_logger = "0.10" log = "0.4" - -[target.'cfg(target_os = "android")'.dependencies] -android_logger = "0.13.3" \ No newline at end of file diff --git a/tools/libvcx_logger/src/lib.rs b/tools/libvcx_logger/src/lib.rs index 63ff30059d..aa4d801559 100644 --- a/tools/libvcx_logger/src/lib.rs +++ b/tools/libvcx_logger/src/lib.rs @@ -1,14 +1,12 @@ use std::{env, io::Write, sync::Once}; -#[cfg(target_os = "android")] -use android_logger::Config; use aries_vcx_core::errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind, VcxCoreResult}; use chrono::{ format::{DelayedFormat, StrftimeItems}, Local, }; use env_logger::{fmt::Formatter, Builder as EnvLoggerBuilder}; -use log::{info, LevelFilter, Record}; +use log::{LevelFilter, Record}; static TEST_LOGGING_INIT: Once = Once::new(); @@ -62,44 +60,24 @@ impl LibvcxDefaultLogger { pub fn init(pattern: Option) -> VcxCoreResult<()> { let pattern = pattern.or(env::var("RUST_LOG").ok()); - if cfg!(target_os = "android") { - #[cfg(target_os = "android")] - let log_filter = match pattern.as_ref() { - Some(val) => match val.to_lowercase().as_ref() { - "error" => Config::default().with_max_level(log::LevelFilter::Error), - "warn" => Config::default().with_max_level(log::LevelFilter::Warn), - "info" => Config::default().with_max_level(log::LevelFilter::Info), - "debug" => Config::default().with_max_level(log::LevelFilter::Debug), - "trace" => Config::default().with_max_level(log::LevelFilter::Trace), - _ => Config::default().with_max_level(log::LevelFilter::Error), - }, - None => Config::default().with_max_level(log::LevelFilter::Error), - }; - - //Set logging to off when deploying production android app. - #[cfg(target_os = "android")] - android_logger::init_once(log_filter); - info!("Logging for Android"); - } else { - let formatter = match env::var("RUST_LOG_FORMATTER") { - Ok(val) => match val.as_str() { - "text_no_color" => text_no_color_format, - _ => text_format, - }, + let formatter = match env::var("RUST_LOG_FORMATTER") { + Ok(val) => match val.as_str() { + "text_no_color" => text_no_color_format, _ => text_format, - }; - EnvLoggerBuilder::new() - .format(formatter) - .filter(None, LevelFilter::Off) - .parse_filters(pattern.as_deref().unwrap_or("warn")) - .try_init() - .map_err(|err| { - AriesVcxCoreError::from_msg( - AriesVcxCoreErrorKind::LoggingError, - format!("Cannot init logger: {:?}", err), - ) - })?; - } + }, + _ => text_format, + }; + EnvLoggerBuilder::new() + .format(formatter) + .filter(None, LevelFilter::Off) + .parse_filters(pattern.as_deref().unwrap_or("warn")) + .try_init() + .map_err(|err| { + AriesVcxCoreError::from_msg( + AriesVcxCoreErrorKind::LoggingError, + format!("Cannot init logger: {:?}", err), + ) + })?; Ok(()) } }