Add log as a dependency, for tracing XML and stuff.

Emmanuel Gil Peyrot created

Change summary

Cargo.toml        | 1 +
src/lib.rs        | 2 ++
src/pubsub/mod.rs | 5 ++++-
3 files changed, 7 insertions(+), 1 deletion(-)

Detailed changes

Cargo.toml 🔗

@@ -18,3 +18,4 @@ tokio-xmpp = "1.0.1"
 xmpp-parsers = "0.15"
 futures = "0.1"
 tokio = "0.1"
+log = "0.4"

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;
 

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<Packet>) -> impl IntoIterator<Item = Event> {
     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<Item = Event> {
     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")]