From f6988a0dc5150d03c48a5e368ea09a7e6f1fe85f Mon Sep 17 00:00:00 2001 From: maayan Date: Fri, 18 Oct 2024 12:21:30 -0400 Subject: [PATCH] print local testnet log as println and errors as eprintln --- crates/aptos/CHANGELOG.md | 1 + crates/aptos/src/node/local_testnet/docker.rs | 3 ++- crates/aptos/src/node/local_testnet/mod.rs | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/aptos/CHANGELOG.md b/crates/aptos/CHANGELOG.md index 6c7f37148bbd1..2e687eba93ecd 100644 --- a/crates/aptos/CHANGELOG.md +++ b/crates/aptos/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to the Aptos CLI will be captured in this file. This project - `aptos move fmt` formats move files inside the `tests` and `examples` directory of a package. - Add `aptos update prover-dependencies`, which installs the dependency of Move prover, boogie, z3 and cvc5. - Update the default version of `movefmt` to be installed from 1.0.4 to 1.0.5 +- Update the local-testnet logs to use `println` for regular output and reserve `eprintln` for errors. ## [4.2.3] - 2024/09/20 - Fix the broken indexer in localnet in 4.2.2, which migrates table info from sycn to async ways. diff --git a/crates/aptos/src/node/local_testnet/docker.rs b/crates/aptos/src/node/local_testnet/docker.rs index 82828be1e5ebc..a118c6eea598c 100644 --- a/crates/aptos/src/node/local_testnet/docker.rs +++ b/crates/aptos/src/node/local_testnet/docker.rs @@ -30,7 +30,8 @@ pub const CONTAINER_NETWORK_NAME: &str = "aptos-local-testnet-network"; /// there no second location, there is just the one named pipe. pub async fn get_docker() -> Result { let docker = Docker::connect_with_local_defaults() - .context(format!("{} (init_default)", ERROR_MESSAGE))?; + .context(format!("{} (init_default)", ERROR_MESSAGE)) + .inspect_err(|e| eprintln!("{:#}", e))?; // We have to specify the type because the compiler can't figure out the error // in the case where the system is Unix. diff --git a/crates/aptos/src/node/local_testnet/mod.rs b/crates/aptos/src/node/local_testnet/mod.rs index 9f56a68f7ef67..638b44b3696e2 100644 --- a/crates/aptos/src/node/local_testnet/mod.rs +++ b/crates/aptos/src/node/local_testnet/mod.rs @@ -135,14 +135,14 @@ impl RunLocalnet { HealthChecker::IndexerApiMetadata(_) => continue, }; if !silent { - eprintln!("{} is starting, please wait...", health_checker); + println!("{} is starting, please wait...", health_checker); } else { info!("[silent] {} is starting, please wait...", health_checker); } let fut = async move { health_checker.wait(None).await?; if !silent { - eprintln!( + println!( "{} is ready. Endpoint: {}", health_checker, health_checker.address_str() @@ -337,7 +337,7 @@ impl CliCommand<()> for RunLocalnet { })?; } - eprintln!( + println!( "\nReadiness endpoint: http://{}:{}/\n", bind_to, self.ready_server_args.ready_server_listen_port, );