diff --git a/Cargo.lock b/Cargo.lock index d42ae47..c670922 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -580,29 +580,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "env_filter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "jiff", - "log", -] - [[package]] name = "equivalent" version = "1.0.2" @@ -1073,11 +1050,9 @@ dependencies = [ "bytes", "chrono", "crossfire", - "env_logger", "futures", "indexmap", "json", - "log", "ns-keyed-archive", "obfstr", "plist", @@ -1091,6 +1066,7 @@ dependencies = [ "thiserror 2.0.17", "tokio", "tokio-rustls", + "tracing", "tun-rs", "uuid", "x509-cert", @@ -1104,15 +1080,15 @@ dependencies = [ "futures", "idevice", "libc", - "log", "once_cell", "plist", "plist_ffi", - "simplelog", "tokio", + "tracing", + "tracing-subscriber", "ureq", "uuid", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1120,14 +1096,14 @@ name = "idevice-tools" version = "0.1.0" dependencies = [ "clap", - "env_logger", "futures-util", "idevice", - "log", "ns-keyed-archive", "plist", "sha2", "tokio", + "tracing", + "tracing-subscriber", "ureq", "uuid", ] @@ -1202,30 +1178,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "jiff" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" -dependencies = [ - "jiff-static", - "log", - "portable-atomic", - "portable-atomic-util", - "serde", -] - -[[package]] -name = "jiff-static" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.106", -] - [[package]] name = "jobserver" version = "0.1.34" @@ -1320,6 +1272,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + [[package]] name = "memchr" version = "2.7.6" @@ -1497,6 +1458,15 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -1550,15 +1520,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_threads" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" -dependencies = [ - "libc", -] - [[package]] name = "obfstr" version = "0.4.4" @@ -1717,21 +1678,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "portable-atomic" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" - -[[package]] -name = "portable-atomic-util" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" -dependencies = [ - "portable-atomic", -] - [[package]] name = "potential_utf" version = "0.1.3" @@ -2145,6 +2091,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -2176,17 +2131,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" -[[package]] -name = "simplelog" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0" -dependencies = [ - "log", - "termcolor", - "time", -] - [[package]] name = "slab" version = "0.4.11" @@ -2311,15 +2255,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.69" @@ -2360,6 +2295,15 @@ dependencies = [ "syn 2.0.106", ] +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + [[package]] name = "time" version = "0.3.44" @@ -2368,9 +2312,7 @@ checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", - "libc", "num-conv", - "num_threads", "powerfmt", "serde", "time-core", @@ -2569,9 +2511,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "tracing-core" version = "0.1.34" @@ -2579,6 +2533,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -2704,6 +2688,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "version_check" version = "0.9.5" @@ -2847,15 +2837,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/ffi/Cargo.toml b/ffi/Cargo.toml index 57e6ef5..d6d78bd 100644 --- a/ffi/Cargo.toml +++ b/ffi/Cargo.toml @@ -7,8 +7,8 @@ edition = "2024" [dependencies] idevice = { path = "../idevice", default-features = false } futures = { version = "0.3", optional = true } -log = "0.4.26" -simplelog = "0.12.2" +tracing = { version = "0.1.41" } +tracing-subscriber = { version = "0.3.20", features = ["env-filter"] } once_cell = "1.21.1" tokio = { version = "1.44.1", features = ["full"] } libc = "0.2.171" @@ -17,7 +17,7 @@ plist_ffi = { version = "0.1.6" } uuid = { version = "1.12", features = ["v4"], optional = true } [target.'cfg(windows)'.dependencies] -windows-sys = { version = "0.60", features = ["Win32_Networking_WinSock"] } +windows-sys = { version = "0.61", features = ["Win32_Networking_WinSock"] } [features] aws-lc = ["idevice/aws-lc"] diff --git a/ffi/src/adapter.rs b/ffi/src/adapter.rs index cc82f89..eec1753 100644 --- a/ffi/src/adapter.rs +++ b/ffi/src/adapter.rs @@ -47,7 +47,7 @@ pub unsafe extern "C" fn adapter_connect( null_mut() } Err(e) => { - log::error!("Adapter connect failed: {e}"); + tracing::error!("Adapter connect failed: {e}"); ffi_err!(e) } } @@ -86,7 +86,7 @@ pub unsafe extern "C" fn adapter_pcap( match res { Ok(_) => null_mut(), Err(e) => { - log::error!("Adapter pcap failed: {e}"); + tracing::error!("Adapter pcap failed: {e}"); ffi_err!(e) } } @@ -169,7 +169,7 @@ pub unsafe extern "C" fn adapter_send( match res { Ok(_) => null_mut(), Err(e) => { - log::error!("Adapter send failed: {e}"); + tracing::error!("Adapter send failed: {e}"); ffi_err!(e) } } @@ -223,7 +223,7 @@ pub unsafe extern "C" fn adapter_recv( null_mut() } Err(e) => { - log::error!("Adapter recv failed: {e}"); + tracing::error!("Adapter recv failed: {e}"); ffi_err!(e) } } diff --git a/ffi/src/afc.rs b/ffi/src/afc.rs index df9aa67..bf0ca7a 100644 --- a/ffi/src/afc.rs +++ b/ffi/src/afc.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn afc_client_connect( client: *mut *mut AfcClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -88,7 +88,7 @@ pub unsafe extern "C" fn afc_client_new( #[unsafe(no_mangle)] pub unsafe extern "C" fn afc_client_free(handle: *mut AfcClientHandle) { if !handle.is_null() { - log::debug!("Freeing afc_client"); + tracing::debug!("Freeing afc_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/amfi.rs b/ffi/src/amfi.rs index 6019826..f23d89d 100644 --- a/ffi/src/amfi.rs +++ b/ffi/src/amfi.rs @@ -26,7 +26,7 @@ pub unsafe extern "C" fn amfi_connect( client: *mut *mut AmfiClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -171,7 +171,7 @@ pub unsafe extern "C" fn amfi_accept_developer_mode( #[unsafe(no_mangle)] pub unsafe extern "C" fn amfi_client_free(handle: *mut AmfiClientHandle) { if !handle.is_null() { - log::debug!("Freeing AmfiClient handle"); + tracing::debug!("Freeing AmfiClient handle"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/core_device/diagnosticsservice.rs b/ffi/src/core_device/diagnosticsservice.rs index 31ca02a..af3b003 100644 --- a/ffi/src/core_device/diagnosticsservice.rs +++ b/ffi/src/core_device/diagnosticsservice.rs @@ -7,7 +7,7 @@ use std::ptr::null_mut; use futures::{Stream, StreamExt}; use idevice::core_device::DiagnostisServiceClient; use idevice::{IdeviceError, ReadWrite, RsdService}; -use log::debug; +use tracing::debug; use crate::core_device_proxy::AdapterHandle; use crate::rsd::RsdHandshakeHandle; diff --git a/ffi/src/core_device_proxy.rs b/ffi/src/core_device_proxy.rs index c3928db..902ee7b 100644 --- a/ffi/src/core_device_proxy.rs +++ b/ffi/src/core_device_proxy.rs @@ -32,7 +32,7 @@ pub unsafe extern "C" fn core_device_proxy_connect( client: *mut *mut CoreDeviceProxyHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -192,7 +192,7 @@ pub unsafe extern "C" fn core_device_proxy_get_client_parameters( netmask: *mut *mut c_char, ) -> *mut IdeviceFfiError { if handle.is_null() { - log::error!("Passed null handle"); + tracing::error!("Passed null handle"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -333,7 +333,7 @@ pub unsafe extern "C" fn core_device_proxy_create_tcp_adapter( #[unsafe(no_mangle)] pub unsafe extern "C" fn core_device_proxy_free(handle: *mut CoreDeviceProxyHandle) { if !handle.is_null() { - log::debug!("Freeing core_device_proxy"); + tracing::debug!("Freeing core_device_proxy"); let _ = unsafe { Box::from_raw(handle) }; } } @@ -349,7 +349,7 @@ pub unsafe extern "C" fn core_device_proxy_free(handle: *mut CoreDeviceProxyHand #[unsafe(no_mangle)] pub unsafe extern "C" fn adapter_free(handle: *mut AdapterHandle) { if !handle.is_null() { - log::debug!("Freeing adapter"); + tracing::debug!("Freeing adapter"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/heartbeat.rs b/ffi/src/heartbeat.rs index 994ced8..bebe115 100644 --- a/ffi/src/heartbeat.rs +++ b/ffi/src/heartbeat.rs @@ -28,7 +28,7 @@ pub unsafe extern "C" fn heartbeat_connect( client: *mut *mut HeartbeatClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -150,7 +150,7 @@ pub unsafe extern "C" fn heartbeat_get_marco( #[unsafe(no_mangle)] pub unsafe extern "C" fn heartbeat_client_free(handle: *mut HeartbeatClientHandle) { if !handle.is_null() { - log::debug!("Freeing installation_proxy_client"); + tracing::debug!("Freeing installation_proxy_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/installation_proxy.rs b/ffi/src/installation_proxy.rs index e3ef63c..079cb84 100644 --- a/ffi/src/installation_proxy.rs +++ b/ffi/src/installation_proxy.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn installation_proxy_connect( client: *mut *mut InstallationProxyClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -101,7 +101,7 @@ pub unsafe extern "C" fn installation_proxy_get_apps( out_result_len: *mut libc::size_t, ) -> *mut IdeviceFfiError { if client.is_null() || out_result.is_null() || out_result_len.is_null() { - log::error!("Invalid arguments: {client:?}, {out_result:?}"); + tracing::error!("Invalid arguments: {client:?}, {out_result:?}"); return ffi_err!(IdeviceError::FfiInvalidArg); } let client = unsafe { &mut *client }; @@ -171,7 +171,7 @@ pub unsafe extern "C" fn installation_proxy_client_free( handle: *mut InstallationProxyClientHandle, ) { if !handle.is_null() { - log::debug!("Freeing installation_proxy_client"); + tracing::debug!("Freeing installation_proxy_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index fc03a00..358cb15 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -189,7 +189,7 @@ pub unsafe extern "C" fn idevice_new_tcp_socket( use crate::util::SockAddr; if addr.is_null() || label.is_null() || idevice.is_null() { - log::error!("null pointer(s) to idevice_new_tcp_socket"); + tracing::error!("null pointer(s) to idevice_new_tcp_socket"); return ffi_err!(IdeviceError::FfiInvalidArg); } let addr = addr as *const SockAddr; diff --git a/ffi/src/lockdown.rs b/ffi/src/lockdown.rs index a6f8959..c3325c5 100644 --- a/ffi/src/lockdown.rs +++ b/ffi/src/lockdown.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn lockdownd_connect( client: *mut *mut LockdowndClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -232,7 +232,7 @@ pub unsafe extern "C" fn lockdownd_get_value( #[unsafe(no_mangle)] pub unsafe extern "C" fn lockdownd_client_free(handle: *mut LockdowndClientHandle) { if !handle.is_null() { - log::debug!("Freeing lockdownd_client"); + tracing::debug!("Freeing lockdownd_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/logging.rs b/ffi/src/logging.rs index 458423e..e274213 100644 --- a/ffi/src/logging.rs +++ b/ffi/src/logging.rs @@ -3,75 +3,12 @@ use std::{ ffi::{CStr, c_char}, fs::File, + sync::Once, }; -use log::LevelFilter; -use simplelog::{ - ColorChoice, CombinedLogger, Config, SharedLogger, TermLogger, TerminalMode, WriteLogger, -}; - -/// Initializes the logger -/// -/// # Arguments -/// * [`console_level`] - The level to log to the file -/// * [`file_level`] - The level to log to the file -/// * [`file_path`] - If not null, the file to write logs to -/// -/// ## Log Level -/// 0. Disabled -/// 1. Error -/// 2. Warn -/// 3. Info -/// 4. Debug -/// 5. Trace -/// -/// # Returns -/// 0 for success, -1 if the file couldn't be created, -2 if a logger has been initialized, -3 for invalid path string -/// -/// # Safety -/// Pass a valid CString for file_path. Pass valid log levels according to the enum -#[unsafe(no_mangle)] -pub unsafe extern "C" fn idevice_init_logger( - console_level: IdeviceLogLevel, - file_level: IdeviceLogLevel, - file_path: *mut c_char, -) -> IdeviceLoggerError { - let mut loggers: Vec> = Vec::new(); - let level: LevelFilter = console_level.into(); - loggers.push(TermLogger::new( - level, - Config::default(), - TerminalMode::Mixed, - ColorChoice::Auto, - )); - - if !file_path.is_null() { - let file_path = match unsafe { CStr::from_ptr(file_path) }.to_str() { - Ok(f) => f.to_string(), - Err(_) => { - return IdeviceLoggerError::InvalidPathString; - } - }; - let level: LevelFilter = file_level.into(); - loggers.push(WriteLogger::new( - level, - Config::default(), - match File::create(file_path) { - Ok(f) => f, - Err(e) => { - println!("Failed to create path: {e:?}"); - return IdeviceLoggerError::FileError; - } - }, - )); - } - - if CombinedLogger::init(loggers).is_err() { - IdeviceLoggerError::AlreadyInitialized - } else { - IdeviceLoggerError::Success - } -} +use tracing::Level; +use tracing_subscriber::{EnvFilter, Layer, fmt::writer::BoxMakeWriter}; +use tracing_subscriber::{Registry, fmt, layer::SubscriberExt, util::SubscriberInitExt}; #[repr(C)] pub enum IdeviceLoggerError { @@ -92,33 +29,99 @@ pub enum IdeviceLogLevel { Trace = 5, } -impl TryFrom for IdeviceLogLevel { - type Error = (); - - fn try_from(value: u8) -> Result { - Ok(match value { - 0 => Self::Disabled, - 1 => Self::ErrorLevel, - 2 => Self::Warn, - 3 => Self::Info, - 4 => Self::Debug, - 5 => Self::Trace, - _ => { - return Err(()); - } - }) - } -} - -impl From for LevelFilter { +impl From for Level { fn from(value: IdeviceLogLevel) -> Self { match value { - IdeviceLogLevel::Disabled => LevelFilter::Off, - IdeviceLogLevel::ErrorLevel => LevelFilter::Error, - IdeviceLogLevel::Warn => LevelFilter::Warn, - IdeviceLogLevel::Info => LevelFilter::Info, - IdeviceLogLevel::Debug => LevelFilter::Debug, - IdeviceLogLevel::Trace => LevelFilter::Trace, + IdeviceLogLevel::Disabled => Level::ERROR, // won't matter, filter will disable + IdeviceLogLevel::ErrorLevel => Level::ERROR, + IdeviceLogLevel::Warn => Level::WARN, + IdeviceLogLevel::Info => Level::INFO, + IdeviceLogLevel::Debug => Level::DEBUG, + IdeviceLogLevel::Trace => Level::TRACE, } } } + +impl IdeviceLogLevel { + fn as_filter(&self) -> String { + match self { + IdeviceLogLevel::Disabled => "off", + IdeviceLogLevel::ErrorLevel => "error", + IdeviceLogLevel::Warn => "warn", + IdeviceLogLevel::Info => "info", + IdeviceLogLevel::Debug => "debug", + IdeviceLogLevel::Trace => "trace", + } + .to_string() + } +} + +// ensures we only init once +static INIT: Once = Once::new(); + +/// Initializes the global logger +/// +/// # Safety +/// Pass a valid file path string +#[unsafe(no_mangle)] +pub unsafe extern "C" fn idevice_init_logger( + console_level: IdeviceLogLevel, + file_level: IdeviceLogLevel, + file_path: *mut c_char, +) -> IdeviceLoggerError { + let mut init_result = IdeviceLoggerError::Success; + + INIT.call_once(|| { + let console_filter = console_level.as_filter(); + let file_filter = file_level.as_filter(); + + let mut layers = Vec::new(); + + // Console layer + if console_level != IdeviceLogLevel::Disabled { + let console_layer = fmt::layer() + .with_writer(std::io::stdout) + .with_ansi(true) + .with_target(false) + .with_filter(EnvFilter::new(console_filter)); + layers.push(console_layer.boxed()); + } + + // File layer + if !file_path.is_null() && file_level != IdeviceLogLevel::Disabled { + let path = match unsafe { CStr::from_ptr(file_path).to_str() } { + Ok(p) => p, + Err(_) => { + init_result = IdeviceLoggerError::InvalidPathString; + return; + } + }; + + let file = match File::create(path) { + Ok(f) => f, + Err(_) => { + init_result = IdeviceLoggerError::FileError; + return; + } + }; + + let file_layer = fmt::layer() + .with_writer(BoxMakeWriter::new(file)) + .with_ansi(false) + .with_target(false) + .with_filter(EnvFilter::new(file_filter)); + layers.push(file_layer.boxed()); + } + + // Compose and set as global subscriber + let subscriber = Registry::default().with(layers); + subscriber.init(); + }); + + // If it was already initialized, Once won't run again + if !INIT.is_completed() { + IdeviceLoggerError::AlreadyInitialized + } else { + init_result + } +} diff --git a/ffi/src/misagent.rs b/ffi/src/misagent.rs index 4028a8e..aca5aaf 100644 --- a/ffi/src/misagent.rs +++ b/ffi/src/misagent.rs @@ -28,7 +28,7 @@ pub unsafe extern "C" fn misagent_connect( client: *mut *mut MisagentClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -218,7 +218,7 @@ pub unsafe extern "C" fn misagent_free_profiles( #[unsafe(no_mangle)] pub unsafe extern "C" fn misagent_client_free(handle: *mut MisagentClientHandle) { if !handle.is_null() { - log::debug!("Freeing misagent_client"); + tracing::debug!("Freeing misagent_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/mobile_image_mounter.rs b/ffi/src/mobile_image_mounter.rs index a539509..6bcf0ef 100644 --- a/ffi/src/mobile_image_mounter.rs +++ b/ffi/src/mobile_image_mounter.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn image_mounter_connect( client: *mut *mut ImageMounterHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -90,7 +90,7 @@ pub unsafe extern "C" fn image_mounter_new( #[unsafe(no_mangle)] pub unsafe extern "C" fn image_mounter_free(handle: *mut ImageMounterHandle) { if !handle.is_null() { - log::debug!("Freeing image_mounter_client"); + tracing::debug!("Freeing image_mounter_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/os_trace_relay.rs b/ffi/src/os_trace_relay.rs index 0e1d8e0..e87d193 100644 --- a/ffi/src/os_trace_relay.rs +++ b/ffi/src/os_trace_relay.rs @@ -46,7 +46,7 @@ pub unsafe extern "C" fn os_trace_relay_connect( client: *mut *mut OsTraceRelayClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -78,7 +78,7 @@ pub unsafe extern "C" fn os_trace_relay_connect( #[unsafe(no_mangle)] pub unsafe extern "C" fn os_trace_relay_free(handle: *mut OsTraceRelayClientHandle) { if !handle.is_null() { - log::debug!("Freeing os trace relay client"); + tracing::debug!("Freeing os trace relay client"); let _ = unsafe { Box::from_raw(handle) }; } } @@ -102,7 +102,7 @@ pub unsafe extern "C" fn os_trace_relay_start_trace( pid: *const u32, ) -> *mut IdeviceFfiError { if receiver.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -137,7 +137,7 @@ pub unsafe extern "C" fn os_trace_relay_start_trace( #[unsafe(no_mangle)] pub unsafe extern "C" fn os_trace_relay_receiver_free(handle: *mut OsTraceRelayReceiverHandle) { if !handle.is_null() { - log::debug!("Freeing syslog relay client"); + tracing::debug!("Freeing syslog relay client"); let _ = unsafe { Box::from_raw(handle) }; } } @@ -186,7 +186,7 @@ pub unsafe extern "C" fn os_trace_relay_next( log: *mut *mut OsTraceLog, ) -> *mut IdeviceFfiError { if client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } diff --git a/ffi/src/pairing_file.rs b/ffi/src/pairing_file.rs index a221e14..d9550fe 100644 --- a/ffi/src/pairing_file.rs +++ b/ffi/src/pairing_file.rs @@ -139,7 +139,7 @@ pub unsafe extern "C" fn idevice_pairing_file_serialize( #[unsafe(no_mangle)] pub unsafe extern "C" fn idevice_pairing_file_free(pairing_file: *mut IdevicePairingFile) { if !pairing_file.is_null() { - log::debug!("Freeing pairing file"); + tracing::debug!("Freeing pairing file"); let _ = unsafe { Box::from_raw(pairing_file) }; } } diff --git a/ffi/src/provider.rs b/ffi/src/provider.rs index 4ef967c..89c020f 100644 --- a/ffi/src/provider.rs +++ b/ffi/src/provider.rs @@ -70,7 +70,7 @@ pub unsafe extern "C" fn idevice_tcp_provider_new( #[unsafe(no_mangle)] pub unsafe extern "C" fn idevice_provider_free(provider: *mut IdeviceProviderHandle) { if !provider.is_null() { - log::debug!("Freeing provider"); + tracing::debug!("Freeing provider"); unsafe { drop(Box::from_raw(provider)) }; } } @@ -109,7 +109,7 @@ pub unsafe extern "C" fn usbmuxd_provider_new( let udid = match unsafe { CStr::from_ptr(udid) }.to_str() { Ok(u) => u.to_string(), Err(e) => { - log::error!("Invalid UDID string: {e:?}"); + tracing::error!("Invalid UDID string: {e:?}"); return ffi_err!(IdeviceError::FfiInvalidString); } }; @@ -117,7 +117,7 @@ pub unsafe extern "C" fn usbmuxd_provider_new( let label = match unsafe { CStr::from_ptr(label) }.to_str() { Ok(l) => l.to_string(), Err(e) => { - log::error!("Invalid label string: {e:?}"); + tracing::error!("Invalid label string: {e:?}"); return ffi_err!(IdeviceError::FfiInvalidArg); } }; diff --git a/ffi/src/springboardservices.rs b/ffi/src/springboardservices.rs index 3c5715c..c969344 100644 --- a/ffi/src/springboardservices.rs +++ b/ffi/src/springboardservices.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn springboard_services_connect( client: *mut *mut SpringBoardServicesClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() || client.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -103,7 +103,7 @@ pub unsafe extern "C" fn springboard_services_get_icon( out_result_len: *mut libc::size_t, ) -> *mut IdeviceFfiError { if client.is_null() || out_result.is_null() || out_result_len.is_null() { - log::error!("Invalid arguments: {client:?}, {out_result:?}"); + tracing::error!("Invalid arguments: {client:?}, {out_result:?}"); return ffi_err!(IdeviceError::FfiInvalidArg); } let client = unsafe { &mut *client }; @@ -145,7 +145,7 @@ pub unsafe extern "C" fn springboard_services_get_icon( #[unsafe(no_mangle)] pub unsafe extern "C" fn springboard_services_free(handle: *mut SpringBoardServicesClientHandle) { if !handle.is_null() { - log::debug!("Freeing springboard_services_client"); + tracing::debug!("Freeing springboard_services_client"); let _ = unsafe { Box::from_raw(handle) }; } } diff --git a/ffi/src/syslog_relay.rs b/ffi/src/syslog_relay.rs index ad38b1d..747d91a 100644 --- a/ffi/src/syslog_relay.rs +++ b/ffi/src/syslog_relay.rs @@ -23,7 +23,7 @@ pub unsafe extern "C" fn syslog_relay_connect_tcp( client: *mut *mut SyslogRelayClientHandle, ) -> *mut IdeviceFfiError { if provider.is_null() { - log::error!("Null pointer provided"); + tracing::error!("Null pointer provided"); return ffi_err!(IdeviceError::FfiInvalidArg); } @@ -58,7 +58,7 @@ pub unsafe extern "C" fn syslog_relay_connect_tcp( #[unsafe(no_mangle)] pub unsafe extern "C" fn syslog_relay_client_free(handle: *mut SyslogRelayClientHandle) { if !handle.is_null() { - log::debug!("Freeing syslog relay client"); + tracing::debug!("Freeing syslog relay client"); let _ = unsafe { Box::from_raw(handle) }; } } @@ -96,7 +96,7 @@ pub unsafe extern "C" fn syslog_relay_next( null_mut() } Err(_) => { - log::error!("Failed to convert log message to C string"); + tracing::error!("Failed to convert log message to C string"); ffi_err!(IdeviceError::FfiInvalidString) } } diff --git a/ffi/src/usbmuxd.rs b/ffi/src/usbmuxd.rs index 05eb650..3d0a24b 100644 --- a/ffi/src/usbmuxd.rs +++ b/ffi/src/usbmuxd.rs @@ -15,7 +15,7 @@ use idevice::{ IdeviceError, usbmuxd::{UsbmuxdAddr, UsbmuxdConnection, UsbmuxdDevice, UsbmuxdListenEvent}, }; -use log::error; +use tracing::error; pub struct UsbmuxdConnectionHandle(pub UsbmuxdConnection); pub struct UsbmuxdAddrHandle(pub UsbmuxdAddr); @@ -132,7 +132,7 @@ pub unsafe extern "C" fn idevice_usbmuxd_new_default_connection( let addr = match UsbmuxdAddr::from_env_var() { Ok(a) => a, Err(e) => { - log::error!("Invalid address set: {e:?}"); + tracing::error!("Invalid address set: {e:?}"); return ffi_err!(IdeviceError::FfiInvalidArg); } }; diff --git a/ffi/src/util.rs b/ffi/src/util.rs index 6088109..0aa496b 100644 --- a/ffi/src/util.rs +++ b/ffi/src/util.rs @@ -48,7 +48,7 @@ pub(crate) fn c_socket_to_rust( addr_len: SockLen, ) -> Result { if addr.is_null() { - log::error!("null sockaddr"); + tracing::error!("null sockaddr"); return invalid_arg(); } @@ -59,7 +59,7 @@ pub(crate) fn c_socket_to_rust( match family as i32 { libc::AF_INET => { if (addr_len as usize) < std::mem::size_of::() { - log::error!("Invalid sockaddr_in size"); + tracing::error!("Invalid sockaddr_in size"); return invalid_arg(); } let a = &*(addr as *const sockaddr_in); @@ -69,7 +69,7 @@ pub(crate) fn c_socket_to_rust( } libc::AF_INET6 => { if (addr_len as usize) < std::mem::size_of::() { - log::error!("Invalid sockaddr_in6 size"); + tracing::error!("Invalid sockaddr_in6 size"); return invalid_arg(); } let a = &*(addr as *const sockaddr_in6); @@ -83,7 +83,7 @@ pub(crate) fn c_socket_to_rust( ))) } _ => { - log::error!( + tracing::error!( "Unsupported socket address family: {}", (*addr).sa_family as i32 ); @@ -95,7 +95,7 @@ pub(crate) fn c_socket_to_rust( match family { AF_INET => { if (addr_len as usize) < std::mem::size_of::() { - log::error!("Invalid SOCKADDR_IN size"); + tracing::error!("Invalid SOCKADDR_IN size"); return invalid_arg(); } let a = &*(addr as *const sockaddr_in); @@ -107,7 +107,7 @@ pub(crate) fn c_socket_to_rust( } AF_INET6 => { if (addr_len as usize) < std::mem::size_of::() { - log::error!("Invalid SOCKADDR_IN6 size"); + tracing::error!("Invalid SOCKADDR_IN6 size"); return invalid_arg(); } let a = &*(addr as *const sockaddr_in6); @@ -124,7 +124,7 @@ pub(crate) fn c_socket_to_rust( ))) } _ => { - log::error!("Unsupported socket address family: {}", (*addr).sa_family); + tracing::error!("Unsupported socket address family: {}", (*addr).sa_family); invalid_arg() } } @@ -133,7 +133,7 @@ pub(crate) fn c_socket_to_rust( pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result { if addr.is_null() { - log::error!("null sockaddr"); + tracing::error!("null sockaddr"); return invalid_arg(); } @@ -157,7 +157,7 @@ pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result { - log::error!( + tracing::error!( "Unsupported socket address family: {}", (*addr).sa_family as i32 ); @@ -178,7 +178,7 @@ pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result { - log::error!("Unsupported socket address family: {}", (*addr).sa_family); + tracing::error!("Unsupported socket address family: {}", (*addr).sa_family); invalid_arg() } } diff --git a/idevice/Cargo.toml b/idevice/Cargo.toml index 0a181f5..3a71d62 100644 --- a/idevice/Cargo.toml +++ b/idevice/Cargo.toml @@ -24,8 +24,7 @@ serde = { version = "1", features = ["derive"] } ns-keyed-archive = { version = "0.1.4", optional = true } thiserror = { version = "2" } -log = { version = "0.4" } -env_logger = { version = "0.11" } +tracing = { version = "0.1.41" } base64 = { version = "0.22" } indexmap = { version = "2.11", features = ["serde"], optional = true } diff --git a/idevice/src/lib.rs b/idevice/src/lib.rs index 6ce77ba..3272104 100644 --- a/idevice/src/lib.rs +++ b/idevice/src/lib.rs @@ -26,7 +26,6 @@ pub use services::*; #[cfg(feature = "xpc")] pub use xpc::RemoteXpcClient; -use log::{debug, error, trace}; use provider::{IdeviceProvider, RsdProvider}; use rustls::{crypto::CryptoProvider, pki_types::ServerName}; use std::{ @@ -35,6 +34,7 @@ use std::{ }; use thiserror::Error; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; +use tracing::{debug, error, trace}; pub use util::{pretty_print_dictionary, pretty_print_plist}; @@ -389,7 +389,7 @@ impl Idevice { } } _ => { - log::error!("Error is not a string or integer from read_plist: {e:?}"); + tracing::error!("Error is not a string or integer from read_plist: {e:?}"); return Err(IdeviceError::UnexpectedResponse); } }; @@ -488,7 +488,7 @@ impl Idevice { // My sanity while debugging the workspace crates are more important. debug!("Using ring crypto backend, because both were passed"); - log::warn!("Both ring && aws-lc are selected as idevice crypto backends!"); + tracing::warn!("Both ring && aws-lc are selected as idevice crypto backends!"); rustls::crypto::ring::default_provider() } }; @@ -497,7 +497,7 @@ impl Idevice { // For whatever reason, getting the default provider will return None on iOS at // random. Installing the default provider a second time will return an error, so // we will log it but not propogate it. An issue should be opened with rustls. - log::error!("Failed to set crypto provider: {e:?}"); + tracing::error!("Failed to set crypto provider: {e:?}"); } } let config = sni::create_client_config(pairing_file)?; diff --git a/idevice/src/pairing_file.rs b/idevice/src/pairing_file.rs index 9288bae..6115af0 100644 --- a/idevice/src/pairing_file.rs +++ b/idevice/src/pairing_file.rs @@ -5,10 +5,10 @@ use std::path::Path; -use log::warn; use plist::Data; use rustls::pki_types::{CertificateDer, pem::PemObject}; use serde::{Deserialize, Serialize}; +use tracing::warn; /// Represents a complete iOS device pairing record /// diff --git a/idevice/src/services/afc/mod.rs b/idevice/src/services/afc/mod.rs index c6319be..f26742e 100644 --- a/idevice/src/services/afc/mod.rs +++ b/idevice/src/services/afc/mod.rs @@ -7,9 +7,9 @@ use std::collections::HashMap; use errors::AfcError; use file::FileDescriptor; -use log::warn; use opcode::{AfcFopenMode, AfcOpcode}; use packet::{AfcPacket, AfcPacketHeader}; +use tracing::warn; use crate::{Idevice, IdeviceError, IdeviceService, obf}; @@ -508,7 +508,7 @@ impl AfcClient { let res = AfcPacket::read(&mut self.idevice).await?; if res.header.operation == AfcOpcode::Status { if res.header_payload.len() < 8 { - log::error!("AFC returned error opcode, but not a code"); + tracing::error!("AFC returned error opcode, but not a code"); return Err(IdeviceError::UnexpectedResponse); } let code = u64::from_le_bytes(res.header_payload[..8].try_into().unwrap()); diff --git a/idevice/src/services/afc/packet.rs b/idevice/src/services/afc/packet.rs index 02efefe..93b5439 100644 --- a/idevice/src/services/afc/packet.rs +++ b/idevice/src/services/afc/packet.rs @@ -1,6 +1,6 @@ // Jackson Coxson -use log::debug; +use tracing::debug; use crate::{Idevice, IdeviceError}; diff --git a/idevice/src/services/bt_packet_logger.rs b/idevice/src/services/bt_packet_logger.rs index d46d2e7..9c581e8 100644 --- a/idevice/src/services/bt_packet_logger.rs +++ b/idevice/src/services/bt_packet_logger.rs @@ -5,7 +5,7 @@ use std::pin::Pin; use futures::Stream; -use log::warn; +use tracing::warn; use crate::{Idevice, IdeviceError, IdeviceService, obf}; diff --git a/idevice/src/services/companion_proxy.rs b/idevice/src/services/companion_proxy.rs index 462966d..95fe4ea 100644 --- a/idevice/src/services/companion_proxy.rs +++ b/idevice/src/services/companion_proxy.rs @@ -1,6 +1,6 @@ //! Companion Proxy is Apple's bridge to connect to the Apple Watch -use log::warn; +use tracing::warn; use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf}; diff --git a/idevice/src/services/core_device/app_service.rs b/idevice/src/services/core_device/app_service.rs index 5b177d9..98e68a9 100644 --- a/idevice/src/services/core_device/app_service.rs +++ b/idevice/src/services/core_device/app_service.rs @@ -1,7 +1,7 @@ // Jackson Coxson -use log::warn; use serde::Deserialize; +use tracing::warn; use crate::{IdeviceError, ReadWrite, RsdService, obf, xpc::XPCObject}; diff --git a/idevice/src/services/core_device/diagnosticsservice.rs b/idevice/src/services/core_device/diagnosticsservice.rs index 803f1fb..c19252f 100644 --- a/idevice/src/services/core_device/diagnosticsservice.rs +++ b/idevice/src/services/core_device/diagnosticsservice.rs @@ -3,7 +3,7 @@ use std::pin::Pin; use futures::Stream; -use log::warn; +use tracing::warn; use crate::{IdeviceError, ReadWrite, RsdService, obf}; diff --git a/idevice/src/services/core_device/mod.rs b/idevice/src/services/core_device/mod.rs index 1f405ce..b4d36df 100644 --- a/idevice/src/services/core_device/mod.rs +++ b/idevice/src/services/core_device/mod.rs @@ -1,7 +1,7 @@ // Jackson Coxson // Ported from pymobiledevice3 -use log::warn; +use tracing::warn; use crate::{ IdeviceError, ReadWrite, RemoteXpcClient, diff --git a/idevice/src/services/crashreportcopymobile.rs b/idevice/src/services/crashreportcopymobile.rs index f98f1a4..4c97220 100644 --- a/idevice/src/services/crashreportcopymobile.rs +++ b/idevice/src/services/crashreportcopymobile.rs @@ -7,7 +7,7 @@ //! function to trigger a flush of crash logs from system storage into the //! crash reports directory by connecting to the `com.apple.crashreportmover` service. -use log::{debug, warn}; +use tracing::{debug, warn}; use crate::{Idevice, IdeviceError, IdeviceService, afc::AfcClient, lockdown::LockdownClient, obf}; diff --git a/idevice/src/services/debug_proxy.rs b/idevice/src/services/debug_proxy.rs index 7e5c28f..b0c99c7 100644 --- a/idevice/src/services/debug_proxy.rs +++ b/idevice/src/services/debug_proxy.rs @@ -4,9 +4,9 @@ //! GDB Remote Serial Protocol as documented at: //! https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#Packets -use log::debug; use std::fmt::Write; use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tracing::debug; use crate::{IdeviceError, ReadWrite, RsdService, obf}; diff --git a/idevice/src/services/dvt/notifications.rs b/idevice/src/services/dvt/notifications.rs index f942ad4..d4ac923 100644 --- a/idevice/src/services/dvt/notifications.rs +++ b/idevice/src/services/dvt/notifications.rs @@ -10,8 +10,8 @@ use crate::{ }, obf, }; -use log::warn; use plist::Value; +use tracing::warn; #[derive(Debug)] pub struct NotificationInfo { diff --git a/idevice/src/services/dvt/process_control.rs b/idevice/src/services/dvt/process_control.rs index f31d046..2e5b28d 100644 --- a/idevice/src/services/dvt/process_control.rs +++ b/idevice/src/services/dvt/process_control.rs @@ -34,8 +34,8 @@ //! } //! ``` -use log::warn; use plist::{Dictionary, Value}; +use tracing::warn; use crate::{IdeviceError, ReadWrite, dvt::message::AuxValue, obf}; diff --git a/idevice/src/services/dvt/remote_server.rs b/idevice/src/services/dvt/remote_server.rs index 82da4c8..9cc8191 100644 --- a/idevice/src/services/dvt/remote_server.rs +++ b/idevice/src/services/dvt/remote_server.rs @@ -51,8 +51,8 @@ use std::collections::{HashMap, VecDeque}; -use log::{debug, warn}; use tokio::io::AsyncWriteExt; +use tracing::{debug, warn}; use crate::{ IdeviceError, ReadWrite, diff --git a/idevice/src/services/installation_proxy.rs b/idevice/src/services/installation_proxy.rs index 325d210..10c716c 100644 --- a/idevice/src/services/installation_proxy.rs +++ b/idevice/src/services/installation_proxy.rs @@ -5,8 +5,8 @@ use std::collections::HashMap; -use log::warn; use plist::Dictionary; +use tracing::warn; use crate::{Idevice, IdeviceError, IdeviceService, obf}; diff --git a/idevice/src/services/lockdown.rs b/idevice/src/services/lockdown.rs index a3b8d15..5d16e23 100644 --- a/idevice/src/services/lockdown.rs +++ b/idevice/src/services/lockdown.rs @@ -3,8 +3,8 @@ //! Provides functionality for interacting with the lockdown service on iOS devices, //! which is the primary service for device management and service discovery. -use log::error; use plist::Value; +use tracing::error; use crate::{Idevice, IdeviceError, IdeviceService, obf, pairing_file}; @@ -256,7 +256,7 @@ impl LockdownClient { let pub_key = match pub_key.as_data().map(|x| x.to_vec()) { Some(p) => p, None => { - log::warn!("Did not get public key data response"); + tracing::warn!("Did not get public key data response"); return Err(IdeviceError::UnexpectedResponse); } }; @@ -265,7 +265,7 @@ impl LockdownClient { let wifi_mac = match wifi_mac.as_string() { Some(w) => w, None => { - log::warn!("Did not get WiFiAddress string"); + tracing::warn!("Did not get WiFiAddress string"); return Err(IdeviceError::UnexpectedResponse); } }; diff --git a/idevice/src/services/misagent.rs b/idevice/src/services/misagent.rs index c033908..1f1a64b 100644 --- a/idevice/src/services/misagent.rs +++ b/idevice/src/services/misagent.rs @@ -3,7 +3,7 @@ //! Provides functionality for interacting with the misagent service on iOS devices, //! which manages provisioning profiles and certificates. -use log::warn; +use tracing::warn; use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf}; diff --git a/idevice/src/services/mobile_image_mounter.rs b/idevice/src/services/mobile_image_mounter.rs index 432acef..11951d0 100644 --- a/idevice/src/services/mobile_image_mounter.rs +++ b/idevice/src/services/mobile_image_mounter.rs @@ -7,7 +7,7 @@ //! //! Handles the complete workflow from uploading images to mounting them with proper signatures. -use log::debug; +use tracing::debug; use crate::{Idevice, IdeviceError, IdeviceService, obf}; use sha2::{Digest, Sha384}; @@ -145,7 +145,7 @@ impl ImageMounter { let image_size = match u64::try_from(image.len()) { Ok(i) => i, Err(e) => { - log::error!("Could not parse image size as u64: {e:?}"); + tracing::error!("Could not parse image size as u64: {e:?}"); return Err(IdeviceError::UnexpectedResponse); } }; @@ -162,7 +162,7 @@ impl ImageMounter { match res.get("Status") { Some(plist::Value::String(s)) => { if s.as_str() != "ReceiveBytesAck" { - log::error!("Received bad response to SendBytes: {s:?}"); + tracing::error!("Received bad response to SendBytes: {s:?}"); return Err(IdeviceError::UnexpectedResponse); } } @@ -178,7 +178,7 @@ impl ImageMounter { match res.get("Status") { Some(plist::Value::String(s)) => { if s.as_str() != "Complete" { - log::error!("Image send failure: {s:?}"); + tracing::error!("Image send failure: {s:?}"); return Err(IdeviceError::UnexpectedResponse); } } @@ -221,7 +221,7 @@ impl ImageMounter { match res.get("Status") { Some(plist::Value::String(s)) => { if s.as_str() != "Complete" { - log::error!("Image send failure: {s:?}"); + tracing::error!("Image send failure: {s:?}"); return Err(IdeviceError::UnexpectedResponse); } } @@ -537,7 +537,7 @@ impl ImageMounter { build_manifest: &plist::Dictionary, unique_chip_id: u64, ) -> Result, IdeviceError> { - use log::{debug, warn}; + use tracing::{debug, warn}; let mut request = TSSRequest::new(); diff --git a/idevice/src/services/mobilebackup2.rs b/idevice/src/services/mobilebackup2.rs index b186710..3ed8e00 100644 --- a/idevice/src/services/mobilebackup2.rs +++ b/idevice/src/services/mobilebackup2.rs @@ -3,12 +3,12 @@ //! Provides functionality for interacting with the mobilebackup2 service on iOS devices, //! which allows creating, restoring, and managing device backups. -use log::{debug, warn}; use plist::Dictionary; use std::fs; use std::io::{Read, Write}; use std::path::Path; use tokio::io::AsyncReadExt; +use tracing::{debug, warn}; use crate::{Idevice, IdeviceError, IdeviceService, obf}; diff --git a/idevice/src/services/preboard_service.rs b/idevice/src/services/preboard_service.rs index 8f5d7f9..98baddf 100644 --- a/idevice/src/services/preboard_service.rs +++ b/idevice/src/services/preboard_service.rs @@ -44,11 +44,11 @@ impl PreboardServiceClient { let res = self.idevice.read_plist().await?; if let Some(res) = res.get("ShowDialog").and_then(|x| x.as_boolean()) { if !res { - log::warn!("ShowDialog is not true"); + tracing::warn!("ShowDialog is not true"); return Err(IdeviceError::UnexpectedResponse); } } else { - log::warn!("No ShowDialog in response from service"); + tracing::warn!("No ShowDialog in response from service"); return Err(IdeviceError::UnexpectedResponse); } diff --git a/idevice/src/services/restore_service.rs b/idevice/src/services/restore_service.rs index 1f3dd73..529d429 100644 --- a/idevice/src/services/restore_service.rs +++ b/idevice/src/services/restore_service.rs @@ -1,7 +1,7 @@ //! Restore Service -use log::warn; use plist::Dictionary; +use tracing::warn; use crate::{IdeviceError, ReadWrite, RemoteXpcClient, RsdService, obf}; diff --git a/idevice/src/services/rsd.rs b/idevice/src/services/rsd.rs index 1f2555a..bf65b55 100644 --- a/idevice/src/services/rsd.rs +++ b/idevice/src/services/rsd.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; -use log::{debug, warn}; use serde::Deserialize; +use tracing::{debug, warn}; use crate::{IdeviceError, ReadWrite, RemoteXpcClient, provider::RsdProvider}; diff --git a/idevice/src/services/screenshotr.rs b/idevice/src/services/screenshotr.rs index 4105242..060632e 100644 --- a/idevice/src/services/screenshotr.rs +++ b/idevice/src/services/screenshotr.rs @@ -4,9 +4,9 @@ //! which allows taking screenshots. use crate::{Idevice, IdeviceError, IdeviceService, obf}; -use log::{debug, warn}; use std::borrow::Cow; use tokio::io::AsyncReadExt; +use tracing::{debug, warn}; pub struct ScreenshotService { /// Underlying device connection pub idevice: Idevice, diff --git a/idevice/src/tcp/adapter.rs b/idevice/src/tcp/adapter.rs index 9d60868..1a87aee 100644 --- a/idevice/src/tcp/adapter.rs +++ b/idevice/src/tcp/adapter.rs @@ -62,11 +62,11 @@ use std::{collections::HashMap, io::ErrorKind, net::IpAddr, path::Path, sync::Arc}; -use log::{debug, trace, warn}; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, sync::Mutex, }; +use tracing::{debug, trace, warn}; use crate::{ReadWrite, tcp::packets::IpParseError}; diff --git a/idevice/src/tcp/handle.rs b/idevice/src/tcp/handle.rs index f4e3718..f6fd9f4 100644 --- a/idevice/src/tcp/handle.rs +++ b/idevice/src/tcp/handle.rs @@ -8,12 +8,12 @@ use std::{collections::HashMap, path::PathBuf, sync::Mutex, task::Poll}; use crossfire::{AsyncRx, MTx, Tx, mpsc, spsc, stream::AsyncStream}; use futures::{StreamExt, stream::FuturesUnordered}; -use log::trace; use tokio::{ io::{AsyncRead, AsyncWrite}, sync::oneshot, time::timeout, }; +use tracing::trace; use crate::tcp::adapter::ConnectionStatus; diff --git a/idevice/src/tcp/mod.rs b/idevice/src/tcp/mod.rs index c984672..feb30d7 100644 --- a/idevice/src/tcp/mod.rs +++ b/idevice/src/tcp/mod.rs @@ -5,8 +5,8 @@ use std::{ time::{SystemTime, UNIX_EPOCH}, }; -use log::trace; use tokio::io::AsyncWriteExt; +use tracing::trace; use crate::{ReadWrite, provider::RsdProvider}; @@ -158,8 +158,6 @@ mod tests { #[tokio::test] async fn local_tcp() { - env_logger::init(); - let our_ip = Ipv6Addr::from_str("fd12:3456:789a::1").unwrap(); let their_ip = Ipv6Addr::from_str("fd12:3456:789a::2").unwrap(); let dev = DeviceBuilder::new() diff --git a/idevice/src/tcp/packets.rs b/idevice/src/tcp/packets.rs index 4ae328f..591d344 100644 --- a/idevice/src/tcp/packets.rs +++ b/idevice/src/tcp/packets.rs @@ -6,11 +6,11 @@ use std::{ sync::Arc, }; -use log::debug; use tokio::{ io::{AsyncRead, AsyncReadExt}, sync::Mutex, }; +use tracing::debug; pub enum ProtocolNumber { Tcp = 6, diff --git a/idevice/src/tcp/stream.rs b/idevice/src/tcp/stream.rs index 6de84e4..fb2d797 100644 --- a/idevice/src/tcp/stream.rs +++ b/idevice/src/tcp/stream.rs @@ -2,8 +2,8 @@ use std::{future::Future, task::Poll}; -use log::trace; use tokio::io::{AsyncRead, AsyncWrite}; +use tracing::trace; use crate::tcp::adapter::ConnectionStatus; diff --git a/idevice/src/tss.rs b/idevice/src/tss.rs index 46ff2cb..1e02e35 100644 --- a/idevice/src/tss.rs +++ b/idevice/src/tss.rs @@ -5,8 +5,8 @@ //! - Apply restore request rules for device-specific parameters //! - Handle cryptographic signing operations -use log::{debug, warn}; use plist::Value; +use tracing::{debug, warn}; use crate::{IdeviceError, util::plist_to_xml_bytes}; diff --git a/idevice/src/tunneld.rs b/idevice/src/tunneld.rs index f6f747c..a11b5a7 100644 --- a/idevice/src/tunneld.rs +++ b/idevice/src/tunneld.rs @@ -5,9 +5,9 @@ use std::{collections::HashMap, net::SocketAddr}; -use log::warn; use serde::{Deserialize, Serialize}; use serde_json::Value; +use tracing::warn; use crate::IdeviceError; diff --git a/idevice/src/usbmuxd/des.rs b/idevice/src/usbmuxd/des.rs index a39a332..5d33236 100644 --- a/idevice/src/usbmuxd/des.rs +++ b/idevice/src/usbmuxd/des.rs @@ -2,8 +2,8 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; -use log::{debug, warn}; use serde::Deserialize; +use tracing::{debug, warn}; use crate::{ IdeviceError, diff --git a/idevice/src/usbmuxd/mod.rs b/idevice/src/usbmuxd/mod.rs index aea74a2..020823a 100644 --- a/idevice/src/usbmuxd/mod.rs +++ b/idevice/src/usbmuxd/mod.rs @@ -13,8 +13,8 @@ use std::{ use std::net::{Ipv4Addr, SocketAddrV4}; use futures::Stream; -use log::{debug, warn}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tracing::{debug, warn}; use crate::{ Idevice, IdeviceError, ReadWrite, pairing_file::PairingFile, provider::UsbmuxdProvider, diff --git a/idevice/src/usbmuxd/raw_packet.rs b/idevice/src/usbmuxd/raw_packet.rs index e19f1a0..0a9aaba 100644 --- a/idevice/src/usbmuxd/raw_packet.rs +++ b/idevice/src/usbmuxd/raw_packet.rs @@ -1,7 +1,7 @@ // Jackson Coxson use crate::util::plist_to_xml_bytes; -use log::warn; +use tracing::warn; #[derive(Debug)] pub struct RawPacket { diff --git a/idevice/src/xpc/format.rs b/idevice/src/xpc/format.rs index 01c241a..f280656 100644 --- a/idevice/src/xpc/format.rs +++ b/idevice/src/xpc/format.rs @@ -5,8 +5,8 @@ use std::{ }; use indexmap::IndexMap; -use log::{debug, warn}; use serde::{Deserialize, Serialize}; +use tracing::{debug, warn}; use crate::IdeviceError; diff --git a/idevice/src/xpc/http2/mod.rs b/idevice/src/xpc/http2/mod.rs index 88ce037..13f0132 100644 --- a/idevice/src/xpc/http2/mod.rs +++ b/idevice/src/xpc/http2/mod.rs @@ -1,9 +1,9 @@ // Jackson Coxson use frame::HttpFrame; -use log::{debug, warn}; use std::collections::{HashMap, VecDeque}; use tokio::io::AsyncWriteExt; +use tracing::{debug, warn}; use crate::{IdeviceError, ReadWrite}; diff --git a/idevice/src/xpc/mod.rs b/idevice/src/xpc/mod.rs index 804e246..65b0426 100644 --- a/idevice/src/xpc/mod.rs +++ b/idevice/src/xpc/mod.rs @@ -3,7 +3,7 @@ use async_stream::try_stream; use futures::Stream; use http2::Setting; -use log::debug; +use tracing::debug; use crate::{IdeviceError, ReadWrite}; diff --git a/tools/Cargo.toml b/tools/Cargo.toml index dc876e7..b88a6c8 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -146,8 +146,8 @@ path = "src/installcoordination_proxy.rs" [dependencies] idevice = { path = "../idevice", features = ["full"], default-features = false } tokio = { version = "1.43", features = ["full"] } -log = { version = "0.4" } -env_logger = { version = "0.11" } +tracing = { version = "0.1.41" } +tracing-subscriber = { version = "0.3", features = ["env-filter"] } # tun-rs = { version = "1.5", features = ["async"] } sha2 = { version = "0.10" } ureq = { version = "3" } diff --git a/tools/src/activation.rs b/tools/src/activation.rs index 6746608..86f65e5 100644 --- a/tools/src/activation.rs +++ b/tools/src/activation.rs @@ -9,7 +9,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("activation") .about("mobileactivationd") diff --git a/tools/src/afc.rs b/tools/src/afc.rs index e2dcefe..6cd3c61 100644 --- a/tools/src/afc.rs +++ b/tools/src/afc.rs @@ -13,7 +13,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("afc") .about("Manage files on the device") diff --git a/tools/src/amfi.rs b/tools/src/amfi.rs index 48d1e37..bff4847 100644 --- a/tools/src/amfi.rs +++ b/tools/src/amfi.rs @@ -7,7 +7,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("amfi") .about("Mess with developer mode") diff --git a/tools/src/app_service.rs b/tools/src/app_service.rs index 334cb67..c286e4e 100644 --- a/tools/src/app_service.rs +++ b/tools/src/app_service.rs @@ -12,7 +12,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("remotexpc") .about("Get services from RemoteXPC") diff --git a/tools/src/bt_packet_logger.rs b/tools/src/bt_packet_logger.rs index eef5d2d..7529200 100644 --- a/tools/src/bt_packet_logger.rs +++ b/tools/src/bt_packet_logger.rs @@ -12,7 +12,7 @@ mod pcap; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("amfi") .about("Capture Bluetooth packets") diff --git a/tools/src/companion_proxy.rs b/tools/src/companion_proxy.rs index 2568df5..f37f345 100644 --- a/tools/src/companion_proxy.rs +++ b/tools/src/companion_proxy.rs @@ -11,7 +11,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("companion_proxy") .about("Apple Watch things") diff --git a/tools/src/crash_logs.rs b/tools/src/crash_logs.rs index 9cbfc24..b17ef13 100644 --- a/tools/src/crash_logs.rs +++ b/tools/src/crash_logs.rs @@ -10,7 +10,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("crash_logs") .about("Manage crash logs") diff --git a/tools/src/debug_proxy.rs b/tools/src/debug_proxy.rs index b7e5625..f965bd8 100644 --- a/tools/src/debug_proxy.rs +++ b/tools/src/debug_proxy.rs @@ -12,7 +12,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("remotexpc") .about("Get services from RemoteXPC") diff --git a/tools/src/diagnostics.rs b/tools/src/diagnostics.rs index 3ea5fe1..674f757 100644 --- a/tools/src/diagnostics.rs +++ b/tools/src/diagnostics.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("idevicediagnostics") .about("Interact with the diagnostics interface of a device") diff --git a/tools/src/diagnosticsservice.rs b/tools/src/diagnosticsservice.rs index e043381..74e6ca4 100644 --- a/tools/src/diagnosticsservice.rs +++ b/tools/src/diagnosticsservice.rs @@ -12,7 +12,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("remotexpc") .about("Gets a sysdiagnose") diff --git a/tools/src/heartbeat_client.rs b/tools/src/heartbeat_client.rs index 2ed1979..b40ba08 100644 --- a/tools/src/heartbeat_client.rs +++ b/tools/src/heartbeat_client.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("core_device_proxy_tun") .about("Start a tunnel") .arg( diff --git a/tools/src/idevice_id.rs b/tools/src/idevice_id.rs index 8ccb1d3..42abd51 100644 --- a/tools/src/idevice_id.rs +++ b/tools/src/idevice_id.rs @@ -6,7 +6,7 @@ use idevice::usbmuxd::UsbmuxdConnection; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let mut muxer = UsbmuxdConnection::default().await.unwrap(); let res = muxer.get_devices().await.unwrap(); diff --git a/tools/src/ideviceinfo.rs b/tools/src/ideviceinfo.rs index 60bdf34..d9f0d85 100644 --- a/tools/src/ideviceinfo.rs +++ b/tools/src/ideviceinfo.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("core_device_proxy_tun") .about("Start a tunnel") diff --git a/tools/src/ideviceinstaller.rs b/tools/src/ideviceinstaller.rs index 346af63..a1c94cf 100644 --- a/tools/src/ideviceinstaller.rs +++ b/tools/src/ideviceinstaller.rs @@ -7,7 +7,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("ideviceinstaller") .about("Install/upgrade apps on an iOS device (AFC + InstallationProxy)") diff --git a/tools/src/installcoordination_proxy.rs b/tools/src/installcoordination_proxy.rs index 4722aa3..d00e867 100644 --- a/tools/src/installcoordination_proxy.rs +++ b/tools/src/installcoordination_proxy.rs @@ -10,7 +10,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("installationcoordination_proxy") .about("") diff --git a/tools/src/instproxy.rs b/tools/src/instproxy.rs index 960a80c..54eb64e 100644 --- a/tools/src/instproxy.rs +++ b/tools/src/instproxy.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("core_device_proxy_tun") .about("Start a tunnel") diff --git a/tools/src/location_simulation.rs b/tools/src/location_simulation.rs index 2f0a128..a38fda9 100644 --- a/tools/src/location_simulation.rs +++ b/tools/src/location_simulation.rs @@ -10,7 +10,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("simulate_location") .about("Simulate device location") diff --git a/tools/src/lockdown.rs b/tools/src/lockdown.rs index ec164c5..2fcf138 100644 --- a/tools/src/lockdown.rs +++ b/tools/src/lockdown.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("lockdown") .about("Start a tunnel") diff --git a/tools/src/misagent.rs b/tools/src/misagent.rs index 966b86f..443607f 100644 --- a/tools/src/misagent.rs +++ b/tools/src/misagent.rs @@ -9,7 +9,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("core_device_proxy_tun") .about("Start a tunnel") diff --git a/tools/src/mobilebackup2.rs b/tools/src/mobilebackup2.rs index e852d8f..18749e8 100644 --- a/tools/src/mobilebackup2.rs +++ b/tools/src/mobilebackup2.rs @@ -15,7 +15,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("mobilebackup2") .about("Mobile Backup 2 tool for iOS devices") diff --git a/tools/src/mounter.rs b/tools/src/mounter.rs index 1564a9d..8b67056 100644 --- a/tools/src/mounter.rs +++ b/tools/src/mounter.rs @@ -13,7 +13,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("core_device_proxy_tun") .about("Start a tunnel") diff --git a/tools/src/notifications.rs b/tools/src/notifications.rs index 8428ef3..703eb9d 100644 --- a/tools/src/notifications.rs +++ b/tools/src/notifications.rs @@ -6,7 +6,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("notifications") .about("start notifications") .arg( diff --git a/tools/src/os_trace_relay.rs b/tools/src/os_trace_relay.rs index b04d0f7..f85f396 100644 --- a/tools/src/os_trace_relay.rs +++ b/tools/src/os_trace_relay.rs @@ -7,7 +7,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("os_trace_relay") .about("Relay system logs") diff --git a/tools/src/pair.rs b/tools/src/pair.rs index 3425e1f..c801054 100644 --- a/tools/src/pair.rs +++ b/tools/src/pair.rs @@ -9,7 +9,7 @@ use idevice::{ #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("pair") .about("Pair with the device") diff --git a/tools/src/pcap.rs b/tools/src/pcap.rs index 28c20a0..5aed440 100644 --- a/tools/src/pcap.rs +++ b/tools/src/pcap.rs @@ -1,6 +1,6 @@ use idevice::bt_packet_logger::BtPacketKind; -use log::warn; use tokio::io::{AsyncWrite, AsyncWriteExt}; +use tracing::warn; // Classic PCAP (big-endian) global header for DLT_BLUETOOTH_HCI_H4_WITH_PHDR (201) const PCAP_GLOBAL_HEADER_BE: [u8; 24] = [ diff --git a/tools/src/pcapd.rs b/tools/src/pcapd.rs index 9cef909..d489f45 100644 --- a/tools/src/pcapd.rs +++ b/tools/src/pcapd.rs @@ -10,7 +10,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("pcapd") .about("Capture IP packets") diff --git a/tools/src/preboard.rs b/tools/src/preboard.rs index b245037..5655db3 100644 --- a/tools/src/preboard.rs +++ b/tools/src/preboard.rs @@ -7,7 +7,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("preboard") .about("Mess with developer mode") diff --git a/tools/src/process_control.rs b/tools/src/process_control.rs index eebe59f..d0939b4 100644 --- a/tools/src/process_control.rs +++ b/tools/src/process_control.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("process_control") .about("Query process control") diff --git a/tools/src/remotexpc.rs b/tools/src/remotexpc.rs index 38a1a8a..31df4b6 100644 --- a/tools/src/remotexpc.rs +++ b/tools/src/remotexpc.rs @@ -11,7 +11,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("remotexpc") .about("Get services from RemoteXPC") diff --git a/tools/src/restore_service.rs b/tools/src/restore_service.rs index 448bd8c..e2a2efd 100644 --- a/tools/src/restore_service.rs +++ b/tools/src/restore_service.rs @@ -10,7 +10,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("restore_service") .about("Interact with the Restore Service service") diff --git a/tools/src/screenshot.rs b/tools/src/screenshot.rs index 6635d91..db55613 100644 --- a/tools/src/screenshot.rs +++ b/tools/src/screenshot.rs @@ -8,7 +8,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("screen_shot") .about("take screenshot") .arg( diff --git a/tools/src/syslog_relay.rs b/tools/src/syslog_relay.rs index c556fec..0552579 100644 --- a/tools/src/syslog_relay.rs +++ b/tools/src/syslog_relay.rs @@ -7,7 +7,7 @@ mod common; #[tokio::main] async fn main() { - env_logger::init(); + tracing_subscriber::fmt::init(); let matches = Command::new("syslog_relay") .about("Relay system logs")