diff --git a/Cargo.toml b/Cargo.toml index 3a3623f..b1a5c45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,12 +25,12 @@ targets = [ features = ["async"] [features] -default = [] # default = [ # "verify_binary_signature", # "panic_on_unsent_packets", # "async", # "winreg", +# "enable_inner_logging", # ] async = ["blocking", "futures"] panic_on_unsent_packets = [] @@ -61,7 +61,7 @@ windows-sys = { version = "0.59", features = [ "Win32_System_LibraryLoader", "Win32_Security_WinTrust", ] } -winreg = { version = "0.52.0", optional = true } +winreg = { package = "winreg2", version = "0.53", optional = true } [dev-dependencies] dotenvy = "0.15" diff --git a/src/log.rs b/src/log.rs index 832d6a6..eab7312 100644 --- a/src/log.rs +++ b/src/log.rs @@ -62,6 +62,10 @@ pub unsafe extern "stdcall" fn default_logger( }) { log::error!("Failed to log message: {}", e); } + #[cfg(not(feature = "enable_inner_logging"))] + if _l == log::Level::Error { + log::error!("WinTun: {}", utf8_msg); + } } #[cfg(feature = "enable_inner_logging")] @@ -84,11 +88,11 @@ fn get_worst_log_msg(container: &[LogItem]) -> Option<&LogItem> { pub(crate) fn extract_wintun_log_error(prifix: &str) -> Result { #[cfg(not(feature = "enable_inner_logging"))] - let info = "".to_string(); + let info = "No inner logs".to_string(); #[cfg(feature = "enable_inner_logging")] let info = get_worst_log_msg(&get_log()) .map(|item| item.msg.clone()) - .unwrap_or_else(|| "No logs".to_string()); + .unwrap_or_else(|| "No inner logs".to_string()); Err(format!("{} \"{}\"", prifix, info)) }