mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-17 09:34:16 -05:00
feat(cli): Remove --debug flag
This commit is contained in:
parent
815692af5b
commit
9af6bcc504
6 changed files with 53 additions and 87 deletions
|
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [Unreleased]
|
||||
|
||||
- ASB + GUI + CLI: Fix an issue where the internal Tor client would fail to choose guards. This would prevent all Tor traffic from working. We temporarily fix this by forcing new guards to be chosen on every startup. This will be reverted once the issue is fixed [upstream](https://gitlab.torproject.org/tpo/core/arti/-/issues/2079)
|
||||
- CLI: Remove the `--debug` flag
|
||||
|
||||
## [3.2.0-rc.4] - 2025-10-17
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ pub async fn initialize_context(
|
|||
})
|
||||
.with_monero(settings.monero_node_config)
|
||||
.with_json(false)
|
||||
.with_debug(true)
|
||||
.with_tor(settings.use_tor)
|
||||
.with_enable_monero_tor(settings.enable_monero_tor)
|
||||
.with_tauri(tauri_handle.clone())
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ use swap_env::config::{
|
|||
};
|
||||
use swap_feed;
|
||||
use swap_machine::alice::is_complete;
|
||||
use tracing_subscriber::filter::LevelFilter;
|
||||
use uuid::Uuid;
|
||||
|
||||
const DEFAULT_WALLET_NAME: &str = "asb-wallet";
|
||||
|
|
@ -53,8 +52,7 @@ fn initialize_tracing(json: bool, config: &Config, trace: bool) -> Result<()> {
|
|||
let format = if json { Format::Json } else { Format::Raw };
|
||||
let log_dir = config.data.dir.join("logs");
|
||||
|
||||
common::tracing_util::init(LevelFilter::DEBUG, format, log_dir, None, trace)
|
||||
.expect("initialize tracing");
|
||||
common::tracing_util::init(format, log_dir, None, trace).expect("initialize tracing");
|
||||
|
||||
tracing::info!(
|
||||
binary = "asb",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ mod config {
|
|||
pub(super) namespace: XmrBtcNamespace,
|
||||
pub env_config: EnvConfig,
|
||||
pub(super) seed: Option<Seed>,
|
||||
pub(super) debug: bool,
|
||||
pub(super) json: bool,
|
||||
pub(super) log_dir: PathBuf,
|
||||
pub(super) data_dir: PathBuf,
|
||||
|
|
@ -57,7 +56,6 @@ mod config {
|
|||
namespace: XmrBtcNamespace::from_is_testnet(false),
|
||||
env_config,
|
||||
seed: seed.into(),
|
||||
debug: false,
|
||||
json: false,
|
||||
is_testnet: false,
|
||||
data_dir,
|
||||
|
|
@ -417,7 +415,6 @@ mod builder {
|
|||
bitcoin: Option<Bitcoin>,
|
||||
data: Option<PathBuf>,
|
||||
is_testnet: bool,
|
||||
debug: bool,
|
||||
json: bool,
|
||||
tor: bool,
|
||||
enable_monero_tor: bool,
|
||||
|
|
@ -441,7 +438,6 @@ mod builder {
|
|||
bitcoin: None,
|
||||
data: None,
|
||||
is_testnet: false,
|
||||
debug: false,
|
||||
json: false,
|
||||
tor: false,
|
||||
enable_monero_tor: false,
|
||||
|
|
@ -480,12 +476,6 @@ mod builder {
|
|||
self
|
||||
}
|
||||
|
||||
/// Whether to include debug level logging messages (default false)
|
||||
pub fn with_debug(mut self, debug: bool) -> Self {
|
||||
self.debug = debug;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set logging format to json (default false)
|
||||
pub fn with_json(mut self, json: bool) -> Self {
|
||||
self.json = json;
|
||||
|
|
@ -515,19 +505,13 @@ mod builder {
|
|||
|
||||
// Initialize logging
|
||||
let format = if self.json { Format::Json } else { Format::Raw };
|
||||
let level_filter = if self.debug {
|
||||
LevelFilter::from_level(Level::DEBUG)
|
||||
} else {
|
||||
LevelFilter::from_level(Level::INFO)
|
||||
};
|
||||
|
||||
START.call_once(|| {
|
||||
let _ = common::tracing_util::init(
|
||||
level_filter,
|
||||
format,
|
||||
log_dir.clone(),
|
||||
self.tauri_handle.clone(),
|
||||
false,
|
||||
true,
|
||||
);
|
||||
tracing::info!(
|
||||
binary = "cli",
|
||||
|
|
@ -716,7 +700,6 @@ mod builder {
|
|||
namespace: XmrBtcNamespace::from_is_testnet(self.is_testnet),
|
||||
env_config,
|
||||
seed: seed.clone().into(),
|
||||
debug: self.debug,
|
||||
json: self.json,
|
||||
is_testnet: self.is_testnet,
|
||||
data_dir: data_dir.clone(),
|
||||
|
|
@ -1165,7 +1148,6 @@ pub mod api_test {
|
|||
namespace: XmrBtcNamespace::from_is_testnet(is_testnet),
|
||||
env_config,
|
||||
seed: seed.into(),
|
||||
debug,
|
||||
json,
|
||||
is_testnet,
|
||||
data_dir,
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ where
|
|||
Err(e) => anyhow::bail!(e),
|
||||
};
|
||||
|
||||
let debug = args.debug;
|
||||
let json = args.json;
|
||||
let is_testnet = args.testnet;
|
||||
let data = args.data;
|
||||
|
||||
let result: Result<Arc<Context>> = match args.cmd {
|
||||
CliCommand::BuyXmr {
|
||||
seller: Seller { seller },
|
||||
|
|
@ -85,7 +85,6 @@ where
|
|||
.with_bitcoin(bitcoin)
|
||||
.with_monero(monero)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -105,7 +104,6 @@ where
|
|||
let context = Arc::new(Context::new_without_tauri_handle());
|
||||
ContextBuilder::new(is_testnet)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -122,7 +120,6 @@ where
|
|||
let context = Arc::new(Context::new_without_tauri_handle());
|
||||
ContextBuilder::new(is_testnet)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -141,7 +138,6 @@ where
|
|||
let context = Arc::new(Context::new_without_tauri_handle());
|
||||
ContextBuilder::new(is_testnet)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -155,7 +151,6 @@ where
|
|||
ContextBuilder::new(is_testnet)
|
||||
.with_bitcoin(bitcoin)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -179,7 +174,6 @@ where
|
|||
ContextBuilder::new(is_testnet)
|
||||
.with_bitcoin(bitcoin)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -202,7 +196,6 @@ where
|
|||
.with_bitcoin(bitcoin)
|
||||
.with_monero(monero)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -219,7 +212,6 @@ where
|
|||
ContextBuilder::new(is_testnet)
|
||||
.with_bitcoin(bitcoin)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -238,7 +230,6 @@ where
|
|||
ContextBuilder::new(is_testnet)
|
||||
.with_tor(tor.enable_tor)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -256,7 +247,6 @@ where
|
|||
ContextBuilder::new(is_testnet)
|
||||
.with_bitcoin(bitcoin)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -271,7 +261,6 @@ where
|
|||
let context = Arc::new(Context::new_without_tauri_handle());
|
||||
ContextBuilder::new(is_testnet)
|
||||
.with_data_dir(data)
|
||||
.with_debug(debug)
|
||||
.with_json(json)
|
||||
.build(context.clone())
|
||||
.await?;
|
||||
|
|
@ -310,9 +299,6 @@ struct Arguments {
|
|||
)]
|
||||
data: Option<PathBuf>,
|
||||
|
||||
#[structopt(long, help = "Activate debug logging")]
|
||||
debug: bool,
|
||||
|
||||
#[structopt(
|
||||
short,
|
||||
long = "json",
|
||||
|
|
|
|||
|
|
@ -13,46 +13,47 @@ use tracing_subscriber::{fmt, EnvFilter, Layer};
|
|||
|
||||
use crate::cli::api::tauri_bindings::{TauriEmitter, TauriHandle, TauriLogEvent};
|
||||
|
||||
const TOR_CRATES: &[&str] = &[
|
||||
"arti",
|
||||
"arti-client",
|
||||
"arti-fork",
|
||||
"tor-api2",
|
||||
"tor-async-utils",
|
||||
"tor-basic-utils",
|
||||
"tor-bytes",
|
||||
"tor-cell",
|
||||
"tor-cert",
|
||||
"tor-chanmgr",
|
||||
"tor-checkable",
|
||||
"tor-circmgr",
|
||||
"tor-config",
|
||||
"tor-config-path",
|
||||
"tor-consdiff",
|
||||
"tor-dirclient",
|
||||
"tor-dirmgr",
|
||||
"tor-error",
|
||||
"tor-general-addr",
|
||||
"tor-guardmgr",
|
||||
"tor-hsclient",
|
||||
"tor-hscrypto",
|
||||
"tor-hsservice",
|
||||
"tor-key-forge",
|
||||
"tor-keymgr",
|
||||
"tor-linkspec",
|
||||
"tor-llcrypto",
|
||||
"tor-log-ratelim",
|
||||
"tor-memquota",
|
||||
"tor-netdir",
|
||||
"tor-netdoc",
|
||||
"tor-persist",
|
||||
"tor-proto",
|
||||
"tor-protover",
|
||||
"tor-relay-selection",
|
||||
"tor-rtcompat",
|
||||
"tor-rtmock",
|
||||
"tor-socksproto",
|
||||
"tor-units",
|
||||
const TOR_CRATES: &[&str] = &["arti", "arti_client"];
|
||||
|
||||
#[allow(dead_code)] // might be useful later
|
||||
const TOR_SUBCRATES: &[&str] = &[
|
||||
"arti_fork",
|
||||
"tor_api2",
|
||||
"tor_async_utils",
|
||||
"tor_basic_utils",
|
||||
"tor_bytes",
|
||||
"tor_cell",
|
||||
"tor_cert",
|
||||
"tor_chanmgr",
|
||||
"tor_checkable",
|
||||
"tor_circmgr",
|
||||
"tor_config",
|
||||
"tor_config_path",
|
||||
"tor_consdiff",
|
||||
"tor_dirclient",
|
||||
"tor_dirmgr",
|
||||
"tor_error",
|
||||
"tor_general_addr",
|
||||
"tor_guardmgr",
|
||||
"tor_hsclient",
|
||||
"tor_hscrypto",
|
||||
"tor_hsservice",
|
||||
"tor_key_forge",
|
||||
"tor_keymgr",
|
||||
"tor_linkspec",
|
||||
"tor_llcrypto",
|
||||
"tor_log_ratelim",
|
||||
"tor_memquota",
|
||||
"tor_netdir",
|
||||
"tor_netdoc",
|
||||
"tor_persist",
|
||||
"tor_proto",
|
||||
"tor_protover",
|
||||
"tor_relay_selection",
|
||||
"tor_rtcompat",
|
||||
"tor_rtmock",
|
||||
"tor_socksproto",
|
||||
"tor_units",
|
||||
];
|
||||
|
||||
const LIBP2P_CRATES: &[&str] = &[
|
||||
|
|
@ -83,19 +84,19 @@ const LIBP2P_CRATES: &[&str] = &[
|
|||
"libp2p_gossipsub",
|
||||
"libp2p_rendezvous",
|
||||
"libp2p_dcutr",
|
||||
"monero_cpp",
|
||||
];
|
||||
|
||||
const OUR_CRATES: &[&str] = &[
|
||||
"swap",
|
||||
"asb",
|
||||
"monero_sys",
|
||||
"unstoppableswap-gui-rs",
|
||||
"unstoppableswap_gui_rs",
|
||||
"seed",
|
||||
"swap_env",
|
||||
"swap_fs",
|
||||
"swap_serde",
|
||||
"monero_rpc_pool",
|
||||
"monero_cpp",
|
||||
];
|
||||
|
||||
/// Output formats for logging messages.
|
||||
|
|
@ -112,7 +113,6 @@ pub enum Format {
|
|||
/// disregarding the arguments to this function. When `trace_stdout` is `true`,
|
||||
/// all tracing logs are also emitted to stdout.
|
||||
pub fn init(
|
||||
level_filter: LevelFilter,
|
||||
format: Format,
|
||||
dir: impl AsRef<Path>,
|
||||
tauri_handle: Option<TauriHandle>,
|
||||
|
|
@ -143,7 +143,7 @@ pub fn init(
|
|||
.json()
|
||||
.with_filter(env_filter_with_all_crates(vec![(
|
||||
OUR_CRATES.to_vec(),
|
||||
level_filter,
|
||||
LevelFilter::DEBUG,
|
||||
)])?);
|
||||
|
||||
// Layer for writing to the verbose log file
|
||||
|
|
@ -187,7 +187,7 @@ pub fn init(
|
|||
.with_line_number(true)
|
||||
.json()
|
||||
.with_filter(env_filter_with_all_crates(vec![
|
||||
(OUR_CRATES.to_vec(), LevelFilter::DEBUG),
|
||||
(OUR_CRATES.to_vec(), LevelFilter::TRACE),
|
||||
(LIBP2P_CRATES.to_vec(), LevelFilter::INFO),
|
||||
(TOR_CRATES.to_vec(), LevelFilter::INFO),
|
||||
])?);
|
||||
|
|
@ -196,11 +196,11 @@ pub fn init(
|
|||
// Otherwise, we only log the bare minimum
|
||||
let terminal_layer_env_filter = match trace_stdout {
|
||||
true => env_filter_with_all_crates(vec![
|
||||
(OUR_CRATES.to_vec(), level_filter),
|
||||
(TOR_CRATES.to_vec(), level_filter),
|
||||
(OUR_CRATES.to_vec(), LevelFilter::DEBUG),
|
||||
(TOR_CRATES.to_vec(), LevelFilter::INFO),
|
||||
(LIBP2P_CRATES.to_vec(), LevelFilter::INFO),
|
||||
])?,
|
||||
false => env_filter_with_all_crates(vec![(OUR_CRATES.to_vec(), level_filter)])?,
|
||||
false => env_filter_with_all_crates(vec![(OUR_CRATES.to_vec(), LevelFilter::INFO)])?,
|
||||
};
|
||||
|
||||
let final_terminal_layer = match format {
|
||||
|
|
@ -222,7 +222,7 @@ pub fn init(
|
|||
subscriber.try_init()?;
|
||||
|
||||
// Now we can use the tracing macros to log messages
|
||||
tracing::info!(%level_filter, logs_dir=%dir.as_ref().display(), "Initialized tracing. General logs will be written to swap-all.log, and verbose logs to tracing*.log");
|
||||
tracing::info!(logs_dir=%dir.as_ref().display(), "Initialized tracing. General logs will be written to swap-all.log, and verbose logs to tracing*.log");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue