From 76619178a2ae23e2b7fd8df4684ca08932c83eef Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 29 Sep 2019 04:08:56 +0200 Subject: [PATCH] Add log as a dependency, for tracing XML and stuff. --- Cargo.toml | 1 + src/lib.rs | 2 ++ src/pubsub/mod.rs | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fc327514..27622a83 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,3 +18,4 @@ tokio-xmpp = "1.0.1" xmpp-parsers = "0.15" futures = "0.1" tokio = "0.1" +log = "0.4" diff --git a/src/lib.rs b/src/lib.rs index dfd98389..486d6326 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,8 @@ use xmpp_parsers::{ stanza_error::{StanzaError, ErrorType, DefinedCondition}, Jid, BareJid, FullJid, JidParseError, }; +#[macro_use] +extern crate log; mod pubsub; diff --git a/src/pubsub/mod.rs b/src/pubsub/mod.rs index 6ab5f0bd..896858c1 100644 --- a/src/pubsub/mod.rs +++ b/src/pubsub/mod.rs @@ -26,7 +26,9 @@ pub(crate) mod avatar; pub(crate) fn handle_event(from: &Jid, elem: Element, mut tx: &mut mpsc::UnboundedSender) -> impl IntoIterator { let mut events = Vec::new(); - match PubSubEvent::try_from(elem) { + let event = PubSubEvent::try_from(elem); + trace!("PubSub event: {:#?}", event); + match event { Ok(PubSubEvent::PublishedItems { node, items }) => { match node.0 { #[cfg(feature = "avatars")] @@ -83,6 +85,7 @@ pub(crate) fn handle_event(from: &Jid, elem: Element, mut tx: &mut mpsc::Unbound pub(crate) fn handle_iq_result(from: &Jid, elem: Element) -> impl IntoIterator { let mut events = Vec::new(); let pubsub = PubSub::try_from(elem).unwrap(); + trace!("PubSub: {:#?}", pubsub); if let PubSub::Items(items) = pubsub { match items.node.0.clone() { #[cfg(feature = "avatars")]