From a3648267f7dc3fd378407bc69616362c4694a3a8 Mon Sep 17 00:00:00 2001 From: Sergey Timoshin Date: Mon, 2 Sep 2024 16:02:33 +0100 Subject: [PATCH 1/3] Switch logging from `log` to `tracing` Replaced the `log` crate with `tracing` for improved structured logging. Switched various log levels, such as from `info` to `debug`, and updated macros accordingly. Adjusted dependencies in `Cargo.toml` and removed `log` crate. --- Cargo.lock | 1 - forester-utils/src/rpc/solana_rpc.rs | 6 ++--- forester/Cargo.toml | 1 - forester/src/config.rs | 8 +++---- forester/src/epoch_manager.rs | 24 ++++++++++++-------- forester/src/lib.rs | 6 ++--- forester/src/main.rs | 6 ++--- forester/src/metrics.rs | 8 +++---- forester/src/photon_indexer.rs | 4 ++-- forester/src/pubsub_client.rs | 12 +++++----- forester/src/queue_helpers.rs | 4 ++-- forester/src/rollover/operations.rs | 6 ++--- forester/src/send_transaction.rs | 12 +++++----- forester/src/settings.rs | 4 ++-- forester/src/slot_tracker.rs | 2 +- forester/src/telemetry.rs | 33 ++++++++++++++++++++++------ forester/src/tree_data_sync.rs | 2 +- forester/src/utils.rs | 4 ++-- forester/tests/test_utils.rs | 4 ++-- 19 files changed, 85 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c365e58b7e..7d95bf36ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2295,7 +2295,6 @@ dependencies = [ "light-registry", "light-system-program", "light-test-utils", - "log", "num-bigint 0.4.6", "num-traits", "once_cell", diff --git a/forester-utils/src/rpc/solana_rpc.rs b/forester-utils/src/rpc/solana_rpc.rs index d6da58f48a..c69ad7cb8d 100644 --- a/forester-utils/src/rpc/solana_rpc.rs +++ b/forester-utils/src/rpc/solana_rpc.rs @@ -5,7 +5,7 @@ use anchor_lang::prelude::Pubkey; use anchor_lang::solana_program::clock::Slot; use anchor_lang::solana_program::hash::Hash; use anchor_lang::AnchorDeserialize; -use log::{debug, info, warn}; +use log::{debug, warn}; use solana_client::rpc_client::RpcClient; use solana_client::rpc_config::{RpcSendTransactionConfig, RpcTransactionConfig}; use solana_program_test::BanksClientError; @@ -151,7 +151,7 @@ impl RpcConnection for SolanaRpcConnection { &self, program_id: &Pubkey, ) -> Result, RpcError> { - info!( + debug!( "Fetching accounts for program: {}, client url: {}", program_id, self.client.url() @@ -361,7 +361,7 @@ impl RpcConnection for SolanaRpcConnection { } async fn get_slot(&mut self) -> Result { - println!("Calling get_slot"); + debug!("Calling get_slot"); self.client.get_slot().map_err(RpcError::from) } diff --git a/forester/Cargo.toml b/forester/Cargo.toml index 21cb19bac2..fb72fa4030 100644 --- a/forester/Cargo.toml +++ b/forester/Cargo.toml @@ -37,7 +37,6 @@ photon-api = { path = "../photon-api" } bincode = "1.3" sysinfo = "0.31" forester-utils = { path = "../forester-utils" } -log = "0.4" env_logger = "0.11" rand = "0.8.5" dotenvy = "0.15.7" diff --git a/forester/src/config.rs b/forester/src/config.rs index 241336f9d9..530c5b4f5d 100644 --- a/forester/src/config.rs +++ b/forester/src/config.rs @@ -1,8 +1,8 @@ use forester_utils::forester_epoch::{Epoch, TreeAccounts, TreeForesterSchedule}; use light_registry::{EpochPda, ForesterEpochPda}; -use log::info; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; +use tracing::debug; #[derive(Debug, Clone)] pub struct ForesterEpochInfo { @@ -21,9 +21,9 @@ impl ForesterEpochInfo { // let state = self.phases.get_current_epoch_state(current_solana_slot); // TODO: add epoch state to sync schedule for tree in trees { - info!("Adding tree schedule for {:?}", tree); - info!("Current slot: {}", current_solana_slot); - info!("Epoch: {:?}", self.epoch_pda); + debug!("Adding tree schedule for {:?}", tree); + debug!("Current slot: {}", current_solana_slot); + debug!("Epoch: {:?}", self.epoch_pda); let tree_schedule = TreeForesterSchedule::new_with_schedule( tree, current_solana_slot, diff --git a/forester/src/epoch_manager.rs b/forester/src/epoch_manager.rs index a35934c5bd..1b9bdf8366 100644 --- a/forester/src/epoch_manager.rs +++ b/forester/src/epoch_manager.rs @@ -134,6 +134,7 @@ impl> EpochManager { Ok(()) } + #[instrument(level = "debug", skip(self, tx))] async fn monitor_epochs(&self, tx: mpsc::Sender) -> Result<()> { let mut last_epoch: Option = None; debug!("Starting epoch monitor"); @@ -159,7 +160,7 @@ impl> EpochManager { let next_phases = get_epoch_phases(&self.protocol_config, next_epoch); let mut rpc = self.rpc_pool.get_connection().await?; let slots_to_wait = next_phases.registration.start.saturating_sub(slot); - info!( + debug!( "Waiting for epoch {} registration phase to start. Current slot: {}, Registration phase start slot: {}, Slots to wait: {}", next_epoch, slot, next_phases.registration.start, slots_to_wait ); @@ -192,7 +193,7 @@ impl> EpochManager { .fetch_add(increment_by, Ordering::Relaxed); } - #[instrument(level = "debug", skip(self), fields(forester = %self.config.payer_keypair.pubkey(), epoch = epoch + #[instrument(level = "info", skip(self), fields(forester = %self.config.payer_keypair.pubkey(), epoch = epoch ))] async fn process_epoch(&self, epoch: u64) -> Result<()> { info!("Entering process_epoch"); @@ -258,7 +259,7 @@ impl> EpochManager { .await { Ok(Some(epoch)) => { - info!("Registered epoch: {:?}", epoch); + debug!("Registered epoch: {:?}", epoch); epoch } Ok(None) => { @@ -279,7 +280,7 @@ impl> EpochManager { .await { Ok(Some(pda)) => { - info!("ForesterEpochPda: {:?}", pda); + debug!("ForesterEpochPda: {:?}", pda); pda } Ok(None) => { @@ -373,7 +374,7 @@ impl> EpochManager { Ok(forester_epoch_info) } - #[instrument(level = "debug", skip(self, epoch_info), fields(forester = %self.config.payer_keypair.pubkey(), epoch = epoch_info.epoch.epoch + #[instrument(level = "info", skip(self, epoch_info), fields(forester = %self.config.payer_keypair.pubkey(), epoch = epoch_info.epoch.epoch ))] async fn wait_for_active_phase( &self, @@ -503,13 +504,13 @@ impl> EpochManager { epoch_pda: ForesterEpochPda, mut tree: TreeForesterSchedule, ) -> Result<()> { - info!("enter process_queue"); - info!("Tree schedule slots: {:?}", tree.slots); + debug!("enter process_queue"); + debug!("Tree schedule slots: {:?}", tree.slots); // TODO: sync at some point let mut estimated_slot = self.slot_tracker.estimated_current_slot(); while estimated_slot < epoch_info.phases.active.end { - info!("Processing queue"); + debug!("Processing queue"); // search for next eligible slot let index_and_forester_slot = tree .slots @@ -517,7 +518,7 @@ impl> EpochManager { .enumerate() .find(|(_, slot)| slot.is_some()); - info!("Result: {:?}", index_and_forester_slot); + debug!("Result: {:?}", index_and_forester_slot); if let Some((index, forester_slot)) = index_and_forester_slot { let forester_slot = forester_slot.as_ref().unwrap().clone(); tree.slots.remove(index); @@ -697,6 +698,11 @@ impl> EpochManager { } } +#[instrument( + level = "info", + skip(config, protocol_config, rpc_pool, indexer, shutdown, work_report_sender, slot_tracker), + fields(forester = %config.payer_keypair.pubkey()) +)] pub async fn run_service>( config: Arc, protocol_config: Arc, diff --git a/forester/src/lib.rs b/forester/src/lib.rs index 822e488cd8..ba7521ebd6 100644 --- a/forester/src/lib.rs +++ b/forester/src/lib.rs @@ -28,12 +28,12 @@ pub use config::{ForesterConfig, ForesterEpochInfo}; use forester_utils::forester_epoch::{TreeAccounts, TreeType}; use forester_utils::indexer::Indexer; use forester_utils::rpc::{RpcConnection, SolanaRpcConnection}; -use log::info; pub use settings::init_config; use solana_sdk::commitment_config::CommitmentConfig; use std::sync::Arc; use std::time::Duration; use tokio::sync::{mpsc, oneshot, Mutex}; +use tracing::debug; pub async fn run_queue_info( config: Arc, @@ -55,7 +55,7 @@ pub async fn run_queue_info( QUEUE_LENGTH .with_label_values(&[&*queue_type.to_string(), &tree_data.merkle_tree.to_string()]) .set(queue_length as i64); - info!( + println!( "{:?} queue {} length: {}", queue_type, tree_data.queue, queue_length ); @@ -102,7 +102,7 @@ pub async fn run_pipeline>( SlotTracker::run(arc_slot_tracker_clone, &mut *rpc).await; }); - info!("Starting Forester pipeline"); + debug!("Starting Forester pipeline"); run_service( config, Arc::new(protocol_config), diff --git a/forester/src/main.rs b/forester/src/main.rs index 9e10015b34..79362628a0 100644 --- a/forester/src/main.rs +++ b/forester/src/main.rs @@ -8,10 +8,10 @@ use forester::tree_data_sync::fetch_trees; use forester::{init_config, run_pipeline, run_queue_info}; use forester_utils::forester_epoch::TreeType; use forester_utils::rpc::{RpcConnection, SolanaRpcConnection}; -use log::{debug, info, warn}; use std::sync::Arc; use tokio::signal::ctrl_c; use tokio::sync::{mpsc, oneshot}; +use tracing::{debug, warn}; #[tokio::main] async fn main() -> Result<(), ForesterError> { @@ -55,8 +55,8 @@ async fn main() -> Result<(), ForesterError> { run_pipeline(config, indexer, shutdown_receiver, work_report_sender).await? } Some(Commands::Status) => { - info!("Fetching trees..."); - info!("RPC URL: {}", config.external_services.rpc_url); + debug!("Fetching trees..."); + debug!("RPC URL: {}", config.external_services.rpc_url); let rpc = SolanaRpcConnection::new(config.external_services.rpc_url.to_string(), None); let trees = fetch_trees(&rpc).await; if trees.is_empty() { diff --git a/forester/src/metrics.rs b/forester/src/metrics.rs index 73d9f91d56..f211ec2755 100644 --- a/forester/src/metrics.rs +++ b/forester/src/metrics.rs @@ -5,7 +5,7 @@ use reqwest::Client; use std::sync::Once; use std::time::{SystemTime, UNIX_EPOCH}; use tokio::sync::Mutex; -use tracing::{error, info}; +use tracing::{debug, error}; lazy_static! { pub static ref REGISTRY: Registry = Registry::new(); @@ -94,7 +94,7 @@ pub fn update_transactions_processed(epoch: u64, count: usize, duration: std::ti .with_label_values(&[&epoch.to_string()]) .set(rate); - info!( + debug!( "Updated metrics for epoch {}: processed = {}, rate = {} tx/s", epoch, count, rate ); @@ -120,13 +120,13 @@ pub async fn push_metrics(url: &str) -> Result<()> { let mut buffer = Vec::new(); encoder.encode(&metric_families, &mut buffer)?; - info!("Pushing metrics to Pushgateway"); + debug!("Pushing metrics to Pushgateway"); let client = Client::new(); let res = client.post(url).body(buffer).send().await?; if res.status().is_success() { - println!("Successfully pushed metrics to Pushgateway"); + debug!("Successfully pushed metrics to Pushgateway"); Ok(()) } else { let error_message = format!( diff --git a/forester/src/photon_indexer.rs b/forester/src/photon_indexer.rs index 7d81f504fb..f0742d4d87 100644 --- a/forester/src/photon_indexer.rs +++ b/forester/src/photon_indexer.rs @@ -2,11 +2,11 @@ use crate::utils::decode_hash; use account_compression::initialize_address_merkle_tree::Pubkey; use forester_utils::indexer::{Indexer, IndexerError, MerkleProof, NewAddressProofWithContext}; use forester_utils::rpc::RpcConnection; -use log::{debug, info}; use photon_api::apis::configuration::{ApiKey, Configuration}; use photon_api::models::GetCompressedAccountsByOwnerPostRequestParams; use solana_sdk::bs58; use std::fmt::Debug; +use tracing::debug; pub struct PhotonIndexer { configuration: Configuration, @@ -132,7 +132,7 @@ impl Indexer for PhotonIndexer { ..Default::default() }; - info!("Request: {:?}", request); + debug!("Request: {:?}", request); let result = photon_api::apis::default_api::get_multiple_new_address_proofs_post( &self.configuration, diff --git a/forester/src/pubsub_client.rs b/forester/src/pubsub_client.rs index 54c540d4c5..ba02a813c6 100644 --- a/forester/src/pubsub_client.rs +++ b/forester/src/pubsub_client.rs @@ -4,7 +4,6 @@ use crate::ForesterConfig; use crate::Result; use account_compression::initialize_address_merkle_tree::Pubkey; use futures::StreamExt; -use log::{debug, error, info}; use solana_account_decoder::UiAccountEncoding; use solana_client::nonblocking::pubsub_client::PubsubClient; use solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig}; @@ -13,12 +12,13 @@ use std::str::FromStr; use std::thread; use tokio::runtime::Builder; use tokio::sync::mpsc; +use tracing::{debug, error}; pub async fn setup_pubsub_client( config: &ForesterConfig, queue_pubkeys: std::collections::HashSet, ) -> Result<(mpsc::Receiver, mpsc::Sender<()>)> { - info!( + debug!( "Setting up pubsub client for {} queues", queue_pubkeys.len() ); @@ -38,7 +38,7 @@ pub async fn setup_pubsub_client( if let Err(e) = result { error!("PubSub client error: {:?}", e); } else { - info!("PubSub client thread completed successfully"); + debug!("PubSub client thread completed successfully"); } } Err(e) => error!("Failed to join PubSub client thread: {:?}", e), @@ -61,12 +61,12 @@ fn spawn_pubsub_client( .map_err(|e| ForesterError::Custom(format!("Failed to build runtime: {}", e)))?; rt.block_on(async { - info!("Connecting to PubSub at {}", ws_url); + debug!("Connecting to PubSub at {}", ws_url); let pubsub_client = PubsubClient::new(&ws_url).await.map_err(|e| { ForesterError::Custom(format!("Failed to create PubsubClient: {}", e)) })?; - info!("PubSub connection established"); + debug!("PubSub connection established"); let (mut subscription, _) = pubsub_client .program_subscribe( @@ -109,7 +109,7 @@ fn spawn_pubsub_client( } } } - info!("PubSub client loop ended"); + debug!("PubSub client loop ended"); Ok(()) }) }) diff --git a/forester/src/queue_helpers.rs b/forester/src/queue_helpers.rs index a16b6365d3..24507c9cf7 100644 --- a/forester/src/queue_helpers.rs +++ b/forester/src/queue_helpers.rs @@ -3,8 +3,8 @@ use account_compression::initialize_address_merkle_tree::Pubkey; use account_compression::QueueAccount; use forester_utils::rpc::RpcConnection; use light_hash_set::HashSet; -use log::debug; use std::mem; +use tracing::debug; #[derive(Debug, Clone)] pub struct QueueItemData { @@ -37,7 +37,7 @@ pub async fn fetch_queue_item_data( } }) .collect(); - log::info!("Queue data fetched: {:?}", filtered_queue); + debug!("Queue data fetched: {:?}", filtered_queue); Ok(filtered_queue) } diff --git a/forester/src/rollover/operations.rs b/forester/src/rollover/operations.rs index 267d2139d9..0de71d450d 100644 --- a/forester/src/rollover/operations.rs +++ b/forester/src/rollover/operations.rs @@ -5,13 +5,13 @@ use light_registry::account_compression_cpi::sdk::{ CreateRolloverMerkleTreeInstructionInputs, }; use light_registry::protocol_config::state::ProtocolConfig; -use log::info; use solana_sdk::instruction::Instruction; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use solana_sdk::transaction::Transaction; use tokio::sync::Mutex; +use tracing::{info, debug}; use crate::errors::ForesterError; use crate::ForesterConfig; @@ -42,7 +42,7 @@ pub async fn is_tree_ready_for_rollover( tree_pubkey: Pubkey, tree_type: TreeType, ) -> Result { - info!( + debug!( "Checking if tree is ready for rollover: {:?}", tree_pubkey.to_string() ); @@ -53,7 +53,7 @@ pub async fn is_tree_ready_for_rollover( .await? .unwrap(); // let account_info = rpc.get_account(tree_pubkey).await?.unwrap(); - + let is_already_rolled_over = account.metadata.rollover_metadata.rolledover_slot != u64::MAX; if is_already_rolled_over { diff --git a/forester/src/send_transaction.rs b/forester/src/send_transaction.rs index 73b137bb92..d23b386dbe 100644 --- a/forester/src/send_transaction.rs +++ b/forester/src/send_transaction.rs @@ -16,7 +16,6 @@ use light_registry::account_compression_cpi::sdk::{ create_nullify_instruction, create_update_address_merkle_tree_instruction, CreateNullifyInstructionInputs, UpdateAddressMerkleTreeInstructionInputs, }; -use log::info; use solana_sdk::compute_budget::ComputeBudgetInstruction; use solana_sdk::instruction::Instruction; use solana_sdk::pubkey::Pubkey; @@ -29,6 +28,7 @@ use std::sync::Arc; use std::{time::Duration, vec}; use tokio::sync::Mutex; use tokio::time::sleep; +use tracing::{debug, warn}; pub trait TransactionBuilder { fn build_signed_transaction_batch( @@ -125,9 +125,9 @@ pub async fn send_batched_transactions( .await; num_sent_transactions += transactions.len(); - info!("build transaction time {:?}", start_time.elapsed()); + debug!("build transaction time {:?}", start_time.elapsed()); let start_time_get_connections = tokio::time::Instant::now(); - info!( + debug!( "get get connections txs time {:?}", start_time_get_connections.elapsed() ); @@ -145,7 +145,7 @@ pub async fn send_batched_transactions( all_results.await; }); - info!( + debug!( "get send txs time {:?}", start_time_get_connections.elapsed() ); @@ -156,7 +156,7 @@ pub async fn send_batched_transactions( // 8. If work items is empty, await minimum batch time. // If this is triggered we could switch to subscribing to the queue if work_items.is_empty() { - info!("Work items empty, waiting for next batch epoch {:?}", epoch); + debug!("Work items empty, waiting for next batch epoch {:?}", epoch); tokio::time::sleep(batch_time).await; } } @@ -201,7 +201,7 @@ pub async fn send_signed_transaction( // info!("Transaction sent: {}", signature); } Err(e) => { - info!("Error sending transaction: {:?}", e); + warn!("Error sending transaction: {:?}", e); return Err(ForesterError::from(e)); } } diff --git a/forester/src/settings.rs b/forester/src/settings.rs index f180bfd68d..db46bc2420 100644 --- a/forester/src/settings.rs +++ b/forester/src/settings.rs @@ -4,12 +4,12 @@ use crate::ForesterConfig; use account_compression::initialize_address_merkle_tree::Pubkey; use anchor_lang::Id; use config::{Config, Environment}; -use log::info; use solana_sdk::signature::{Keypair, Signer}; use std::fmt::{Display, Formatter}; use std::path::Path; use std::str::FromStr; use std::{env, fmt}; +use tracing::debug; pub enum SettingsKey { Payer, @@ -137,7 +137,7 @@ pub fn init_config() -> Result { state_tree_data: vec![], }; - info!("Config: {:?}", config); + debug!("Config: {:?}", config); Ok(config) } diff --git a/forester/src/slot_tracker.rs b/forester/src/slot_tracker.rs index 93e0edcf8f..f68d22ad0e 100644 --- a/forester/src/slot_tracker.rs +++ b/forester/src/slot_tracker.rs @@ -1,9 +1,9 @@ use forester_utils::rpc::RpcConnection; -use log::{debug, error}; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::UNIX_EPOCH; use std::{sync::Arc, time::SystemTime}; use tokio::time::{sleep, Duration}; +use tracing::{debug, error}; pub fn slot_duration() -> Duration { Duration::from_nanos(solana_sdk::genesis_config::GenesisConfig::default().ns_per_slot() as u64) diff --git a/forester/src/telemetry.rs b/forester/src/telemetry.rs index ef618fb283..1141cadb20 100644 --- a/forester/src/telemetry.rs +++ b/forester/src/telemetry.rs @@ -1,7 +1,7 @@ use env_logger::Env; use std::sync::Once; use tracing_appender::rolling::{RollingFileAppender, Rotation}; -use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; +use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer}; static INIT: Once = Once::new(); @@ -13,16 +13,35 @@ pub fn setup_telemetry() { let env_filter = EnvFilter::try_from_default_env() .unwrap_or_else(|_| EnvFilter::new("info,forester=debug")); + let file_env_filter = EnvFilter::new("info,forester=debug"); + let stdout_env_filter = + EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); + + let stdout_layer = fmt::Layer::new() + .with_writer(std::io::stdout) + .with_ansi(true) + .with_filter(stdout_env_filter); + + let file_layer = fmt::Layer::new() + .with_writer(non_blocking) + .with_filter(file_env_filter); + tracing_subscriber::registry() .with(env_filter) - .with( - fmt::Layer::new() - .with_writer(std::io::stdout) - .with_ansi(true), - ) - .with(fmt::Layer::new().with_writer(non_blocking).json()) + .with(stdout_layer) + .with(file_layer) .init(); + // tracing_subscriber::registry() + // .with(env_filter) + // .with( + // fmt::Layer::new() + // .with_writer(std::io::stdout) + // .with_ansi(true), + // ) + // .with(fmt::Layer::new().with_writer(non_blocking).json()) + // .init(); + // Keep _guard in scope to keep the non-blocking writer alive std::mem::forget(_guard); }); diff --git a/forester/src/tree_data_sync.rs b/forester/src/tree_data_sync.rs index baa56a8d5b..77d495f01c 100644 --- a/forester/src/tree_data_sync.rs +++ b/forester/src/tree_data_sync.rs @@ -4,9 +4,9 @@ use account_compression::{AddressMerkleTreeAccount, MerkleTreeMetadata, StateMer use borsh::BorshDeserialize; use forester_utils::forester_epoch::{TreeAccounts, TreeType}; use forester_utils::rpc::RpcConnection; -use log::debug; use solana_sdk::account::Account; use solana_sdk::pubkey::Pubkey; +use tracing::debug; pub async fn fetch_trees(rpc: &R) -> Vec { let program_id = account_compression::id(); diff --git a/forester/src/utils.rs b/forester/src/utils.rs index f101734e09..9051463ebb 100644 --- a/forester/src/utils.rs +++ b/forester/src/utils.rs @@ -1,10 +1,10 @@ use forester_utils::rpc::RpcConnection; use light_registry::protocol_config::state::{ProtocolConfig, ProtocolConfigPda}; use light_registry::utils::get_protocol_config_pda_address; -use log::{debug, info}; use std::process::Command; use std::time::{SystemTime, UNIX_EPOCH}; use sysinfo::{Signal, System}; +use tracing::debug; #[derive(Debug)] pub struct LightValidatorConfig { @@ -90,7 +90,7 @@ pub async fn get_protocol_config(rpc: &mut R) -> ProtocolConfi .await .unwrap() .unwrap(); - info!("Protocol config account: {:?}", protocol_config_account); + debug!("Protocol config account: {:?}", protocol_config_account); protocol_config_account.config } diff --git a/forester/tests/test_utils.rs b/forester/tests/test_utils.rs index 7701579fac..38a6c4e7aa 100644 --- a/forester/tests/test_utils.rs +++ b/forester/tests/test_utils.rs @@ -10,8 +10,8 @@ use forester_utils::rpc::{RpcConnection, SolanaRpcConnection}; use light_test_utils::e2e_test_env::{GeneralActionConfig, KeypairActionConfig, User}; use light_test_utils::indexer::TestIndexer; use light_test_utils::test_env::get_test_env_accounts; -use log::{debug, info}; use solana_sdk::signature::{Keypair, Signer}; +use tracing::debug; #[allow(dead_code)] pub async fn init(config: Option) { @@ -137,7 +137,7 @@ pub async fn assert_new_address_proofs_for_photon_and_test_indexer Date: Mon, 2 Sep 2024 16:07:05 +0100 Subject: [PATCH 2/3] Swap `tracing` import order and remove trailing whitespace --- forester/src/rollover/operations.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forester/src/rollover/operations.rs b/forester/src/rollover/operations.rs index 0de71d450d..d89fb45385 100644 --- a/forester/src/rollover/operations.rs +++ b/forester/src/rollover/operations.rs @@ -11,7 +11,7 @@ use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; use solana_sdk::transaction::Transaction; use tokio::sync::Mutex; -use tracing::{info, debug}; +use tracing::{debug, info}; use crate::errors::ForesterError; use crate::ForesterConfig; @@ -53,7 +53,7 @@ pub async fn is_tree_ready_for_rollover( .await? .unwrap(); // let account_info = rpc.get_account(tree_pubkey).await?.unwrap(); - + let is_already_rolled_over = account.metadata.rollover_metadata.rolledover_slot != u64::MAX; if is_already_rolled_over { From 6078376c22478fe87589c863ab67b03f92d13cce Mon Sep 17 00:00:00 2001 From: Sergey Timoshin Date: Mon, 2 Sep 2024 17:14:32 +0100 Subject: [PATCH 3/3] Remove commented code. --- forester/src/telemetry.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/forester/src/telemetry.rs b/forester/src/telemetry.rs index 1141cadb20..3103dd00de 100644 --- a/forester/src/telemetry.rs +++ b/forester/src/telemetry.rs @@ -32,16 +32,6 @@ pub fn setup_telemetry() { .with(file_layer) .init(); - // tracing_subscriber::registry() - // .with(env_filter) - // .with( - // fmt::Layer::new() - // .with_writer(std::io::stdout) - // .with_ansi(true), - // ) - // .with(fmt::Layer::new().with_writer(non_blocking).json()) - // .init(); - // Keep _guard in scope to keep the non-blocking writer alive std::mem::forget(_guard); });