Skip to content

Commit

Permalink
add debugging tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Feb 21, 2024
1 parent 8e948f2 commit 3c312ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/delano-wit-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ delanocreds = { workspace = true }
delano-keys = { workspace = true }
delano-events = { workspace = true }
wit-bindgen = { version = "0.16.0", default-features = false, features = ["realloc"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[dev-dependencies]
wasmtime = { version = "17", features = ['component-model'] }
Expand Down
10 changes: 10 additions & 0 deletions crates/delano-wit-ui/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,30 @@ impl State {

self.history.push(history);

tracing::debug!("1/5 Offer: {:?}", offered);

// Also, subscribe to this publish_key by emitting SubscribeToKey
let subscribe_msg = SubscribeTopic::from(publish_key);

tracing::debug!("2/5 Subscribe: {:?}", subscribe_msg);

// Use the type's built-in serialization and encoding
let base64_publishables = subscribe_msg.serialize_encode()?;

tracing::debug!("3/5 Publishables: {:?}", base64_publishables);

// Wrap in Context, so the Wurbo Router can route it.
let message_data = Context::Message(base64_publishables.to_string());
// Serialize as JSON so `jco` can parse it in the JavaScript glue code.
let message = serde_json::to_string(&message_data).unwrap_or_default();

tracing::debug!("4/5 Message: {:?}", message);

// Emit the message
wurbo_in::emit(&message);

tracing::debug!("5/5 Emitted.");

Ok(Some(offered))
}
_ => Ok(None),
Expand Down

0 comments on commit 3c312ed

Please sign in to comment.