From 58a50d12c77b53bf649b7d70dd42bd6d1d6f1487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Galv=C3=A1n=20=28Dub=29?= Date: Wed, 7 Feb 2024 11:59:35 -0300 Subject: [PATCH] [Torii] Debug output of all indexed Events (#1464) * torii - Log events in debug!() as hex * change debug!() for trace!() * structured logging * fix: fmt --------- Co-authored-by: glihm --- crates/torii/core/src/engine.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/torii/core/src/engine.rs b/crates/torii/core/src/engine.rs index 55e6a57114..a12855e9b3 100644 --- a/crates/torii/core/src/engine.rs +++ b/crates/torii/core/src/engine.rs @@ -11,7 +11,7 @@ use starknet::providers::Provider; use tokio::sync::broadcast::Sender; use tokio::sync::mpsc::Sender as BoundedSender; use tokio::time::sleep; -use tracing::{error, info, warn}; +use tracing::{error, info, trace, warn}; use crate::processors::{BlockProcessor, EventProcessor, TransactionProcessor}; use crate::sql::Sql; @@ -50,6 +50,11 @@ pub struct Engine<'db, P: Provider + Sync> { block_tx: Option>, } +struct UnprocessedEvent { + keys: Vec, + data: Vec, +} + impl<'db, P: Provider + Sync> Engine<'db, P> { pub fn new( world: WorldContractReader

, @@ -253,6 +258,17 @@ impl<'db, P: Provider + Sync> Engine<'db, P> { processor .process(&self.world, self.db, block, invoke_receipt, event_id, event) .await?; + } else { + let unprocessed_event = UnprocessedEvent { + keys: event.keys.iter().map(|k| format!("{:#x}", k)).collect(), + data: event.data.iter().map(|d| format!("{:#x}", d)).collect(), + }; + + trace!( + keys = ?unprocessed_event.keys, + data = ?unprocessed_event.data, + "unprocessed event", + ); } } Ok(())