From 92d9a5b017e6a4d87f3a7888878823bf07ed7705 Mon Sep 17 00:00:00 2001 From: dubzn Date: Fri, 19 Jan 2024 15:32:16 -0300 Subject: [PATCH 1/4] torii - Log events in debug!() as hex --- crates/torii/core/src/engine.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/torii/core/src/engine.rs b/crates/torii/core/src/engine.rs index 55e6a57114..4a4359ba2a 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::{debug, error, info, warn}; use crate::processors::{BlockProcessor, EventProcessor, TransactionProcessor}; use crate::sql::Sql; @@ -253,6 +253,10 @@ impl<'db, P: Provider + Sync> Engine<'db, P> { processor .process(&self.world, self.db, block, invoke_receipt, event_id, event) .await?; + } else { + let keys: Vec = event.keys.iter().map(|k| format!("{:#x}", k)).collect(); + let data: Vec = event.data.iter().map(|d| format!("{:#x}", d)).collect(); + debug!("Event {{ keys: {:?}, data: {:?} }}", keys, data); } } Ok(()) From 77ae0835e4bec8f1afdcb39c0f2e4cc1d4988515 Mon Sep 17 00:00:00 2001 From: dubzn Date: Tue, 23 Jan 2024 09:22:45 -0300 Subject: [PATCH 2/4] change debug!() for trace!() --- crates/torii/core/src/engine.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/torii/core/src/engine.rs b/crates/torii/core/src/engine.rs index 4a4359ba2a..18b50f27aa 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::{debug, error, info, warn}; +use tracing::{error, info, trace, warn}; use crate::processors::{BlockProcessor, EventProcessor, TransactionProcessor}; use crate::sql::Sql; @@ -256,7 +256,7 @@ impl<'db, P: Provider + Sync> Engine<'db, P> { } else { let keys: Vec = event.keys.iter().map(|k| format!("{:#x}", k)).collect(); let data: Vec = event.data.iter().map(|d| format!("{:#x}", d)).collect(); - debug!("Event {{ keys: {:?}, data: {:?} }}", keys, data); + trace!("Event {{ keys: {:?}, data: {:?} }}", keys, data); } } Ok(()) From b94358f370808257e2456382f674efb8224f5c88 Mon Sep 17 00:00:00 2001 From: dubzn Date: Mon, 5 Feb 2024 15:49:59 -0300 Subject: [PATCH 3/4] structured logging --- crates/torii/core/src/engine.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/torii/core/src/engine.rs b/crates/torii/core/src/engine.rs index 18b50f27aa..acd26d3f4a 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, trace, 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

, @@ -254,9 +259,16 @@ impl<'db, P: Provider + Sync> Engine<'db, P> { .process(&self.world, self.db, block, invoke_receipt, event_id, event) .await?; } else { - let keys: Vec = event.keys.iter().map(|k| format!("{:#x}", k)).collect(); - let data: Vec = event.data.iter().map(|d| format!("{:#x}", d)).collect(); - trace!("Event {{ keys: {:?}, data: {:?} }}", keys, data); + 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(()) From a30edd3678758a0303fae967cdc5c8806d544b0d Mon Sep 17 00:00:00 2001 From: glihm Date: Wed, 7 Feb 2024 08:29:40 -0600 Subject: [PATCH 4/4] fix: fmt --- crates/torii/core/src/engine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/torii/core/src/engine.rs b/crates/torii/core/src/engine.rs index acd26d3f4a..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, trace, warn }; +use tracing::{error, info, trace, warn}; use crate::processors::{BlockProcessor, EventProcessor, TransactionProcessor}; use crate::sql::Sql;