@@ -8,7 +8,7 @@ use builder::config::HostProvider;
88use init4_bin_base:: {
99 deps:: {
1010 metrics:: { counter, histogram} ,
11- tracing,
11+ tracing:: { debug , error } ,
1212 } ,
1313 init4,
1414 utils:: { from_env:: FromEnv , signer:: LocalOrAwsConfig } ,
@@ -44,16 +44,17 @@ async fn main() {
4444 let _guard = init4 ( ) ;
4545
4646 let config = Config :: from_env ( ) . unwrap ( ) ;
47- tracing:: trace!( "connecting to provider" ) ;
47+ debug ! ( ?config. recipient_address, "connecting to provider" ) ;
48+
4849 let provider = config. provider ( ) . await ;
4950 let recipient_address = config. recipient_address ;
5051 let sleep_time = config. sleep_time ;
5152
5253 loop {
53- tracing :: debug!( "attempting transaction" ) ;
54+ debug ! ( ?recipient_address , "attempting transaction" ) ;
5455 send_transaction ( & provider, recipient_address) . await ;
5556
56- tracing :: debug!( sleep_time, "sleeping" ) ;
57+ debug ! ( sleep_time, "sleeping" ) ;
5758 tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( sleep_time) ) . await ;
5859 }
5960}
@@ -70,18 +71,17 @@ async fn send_transaction(provider: &HostProvider, recipient_address: Address) {
7071 let dispatch_start_time: Instant = Instant :: now ( ) ;
7172
7273 // dispatch the transaction
73- tracing:: debug!( "dispatching transaction" ) ;
7474 let result = provider. send_transaction ( tx) . await . unwrap ( ) ;
7575
7676 // wait for the transaction to mine
7777 let receipt = match timeout ( Duration :: from_secs ( 240 ) , result. get_receipt ( ) ) . await {
7878 Ok ( Ok ( receipt) ) => receipt,
7979 Ok ( Err ( e) ) => {
80- tracing :: error!( error = ?e, "failed to get transaction receipt" ) ;
80+ error ! ( error = ?e, "failed to get transaction receipt" ) ;
8181 return ;
8282 }
8383 Err ( _) => {
84- tracing :: error!( "timeout waiting for transaction receipt" ) ;
84+ error ! ( "timeout waiting for transaction receipt" ) ;
8585 counter ! ( "txn_submitter.tx_timeout" ) . increment ( 1 ) ;
8686 return ;
8787 }
@@ -91,6 +91,6 @@ async fn send_transaction(provider: &HostProvider, recipient_address: Address) {
9191
9292 // record metrics for how long it took to mine the transaction
9393 let mine_time = dispatch_start_time. elapsed ( ) . as_secs ( ) ;
94- tracing :: debug!( success = receipt. status( ) , mine_time, hash, "transaction mined" ) ;
94+ debug ! ( success = receipt. status( ) , mine_time, hash, "transaction mined" ) ;
9595 histogram ! ( "txn_submitter.tx_mine_time" ) . record ( mine_time as f64 ) ;
9696}
0 commit comments