Skip to content

Commit 95195c8

Browse files
committed
Merge branch 'main' into ceyhun/clementine_support
2 parents 7162243 + d3b6daf commit 95195c8

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ bollard = { version = "0.17.1" }
1313
futures = "0.3"
1414
hex = { version = "0.4.3", default-features = false, features = ["serde"] }
1515
jsonrpsee = { version = "0.24.2", features = ["http-client", "ws-client"] }
16+
log-panics = { version = "2", features = ["with-backtrace"] }
1617
rand = "0.8"
1718
serde = { version = "1.0.192", default-features = false, features = ["alloc", "derive"] }
1819
serde_json = { version = "1.0", default-features = false }
1920
tempfile = "3.8"
2021
tokio = { version = "1.39", features = ["full"] }
2122
toml = "0.8.0"
2223
tracing = { version = "0.1.40", default-features = false }
24+
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json", "fmt"] }
2325

2426
# Citrea dependencies
2527
sov-ledger-rpc = { git = "https://github.com/chainwayxyz/citrea", rev = "82bf52d", default-features = false, features = ["client"] }

src/batch_prover.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::time::SystemTime;
22

33
use anyhow::bail;
44
use tokio::time::{sleep, Duration};
5-
use tracing::debug;
5+
use tracing::trace;
66

77
use super::{config::FullBatchProverConfig, Result};
88
use crate::node::Node;
@@ -14,7 +14,7 @@ impl BatchProver {
1414
let start = SystemTime::now();
1515
let timeout = timeout.unwrap_or(Duration::from_secs(600));
1616
loop {
17-
debug!("Waiting for batch prover height {}", height);
17+
trace!("Waiting for batch prover height {}", height);
1818
let latest_block = self.client.ledger_get_last_scanned_l1_height().await?;
1919

2020
if latest_block >= height {

src/framework.rs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
use std::{future::Future, sync::Arc};
1+
use std::{
2+
future::Future,
3+
sync::{Arc, Once},
4+
};
25

36
use bitcoincore_rpc::RpcApi;
47
use tracing::{debug, info};
8+
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
59

610
use super::{
711
bitcoin::BitcoinNodeCluster, config::TestConfig, docker::DockerEnv, full_node::FullNode,
@@ -55,6 +59,8 @@ async fn create_optional<T>(pred: bool, f: impl Future<Output = Result<T>>) -> R
5559

5660
impl TestFramework {
5761
pub async fn new(config: TestConfig) -> Result<Self> {
62+
setup_logging();
63+
5864
anyhow::ensure!(
5965
config.test_case.n_nodes > 0,
6066
"At least one bitcoin node has to be running"
@@ -231,3 +237,27 @@ impl TestFramework {
231237
Ok(())
232238
}
233239
}
240+
241+
static INIT: Once = Once::new();
242+
243+
fn setup_logging() {
244+
INIT.call_once(|| {
245+
let env_filter = EnvFilter::try_from_default_env()
246+
.or_else(|_| EnvFilter::try_new("citrea_e2e=info"))
247+
.unwrap();
248+
249+
if std::env::var("JSON_LOGS").is_ok() {
250+
let _ = tracing_subscriber::registry()
251+
.with(fmt::layer().json())
252+
.with(env_filter)
253+
.try_init();
254+
} else {
255+
let _ = tracing_subscriber::registry()
256+
.with(fmt::layer())
257+
.with(env_filter)
258+
.try_init();
259+
}
260+
261+
log_panics::init();
262+
});
263+
}

0 commit comments

Comments
 (0)