From 3ac741d666183bdee00586fbd4eea9d2b72bdaee Mon Sep 17 00:00:00 2001 From: xmppftw Date: Mon, 5 Jun 2023 13:06:52 +0200 Subject: [PATCH] RUST_LOG=debug can now be used in tokio-xmpp examples to see XMPP network traffic --- tokio-xmpp/Cargo.toml | 3 +++ tokio-xmpp/ChangeLog | 4 +++- tokio-xmpp/examples/contact_addr.rs | 2 ++ tokio-xmpp/examples/download_avatars.rs | 2 ++ tokio-xmpp/examples/echo_bot.rs | 2 ++ tokio-xmpp/examples/echo_component.rs | 2 ++ tokio-xmpp/examples/send_message.rs | 2 ++ 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tokio-xmpp/Cargo.toml b/tokio-xmpp/Cargo.toml index 920e2f15..6dc5d4c6 100644 --- a/tokio-xmpp/Cargo.toml +++ b/tokio-xmpp/Cargo.toml @@ -31,6 +31,9 @@ rxml = "0.9.1" webpki-roots = { version = "0.23", optional = true } rand = "^0.8" +[dev-dependencies] +env_logger = "0.10" + [build-dependencies] rustc_version = "0.4" diff --git a/tokio-xmpp/ChangeLog b/tokio-xmpp/ChangeLog index 00f8736c..9f247b2e 100644 --- a/tokio-xmpp/ChangeLog +++ b/tokio-xmpp/ChangeLog @@ -1,3 +1,5 @@ xxxxxxxxxx * Breaking changes: - - AsyncClient::new takes a parsed Jid instead of string (#72) \ No newline at end of file + - AsyncClient::new takes a parsed Jid instead of string (#72) + * Changes: + - env_logger is now included in dev_dependencies for examples debugging with RUST_LOG=debug \ No newline at end of file diff --git a/tokio-xmpp/examples/contact_addr.rs b/tokio-xmpp/examples/contact_addr.rs index 65e1062c..640d3833 100644 --- a/tokio-xmpp/examples/contact_addr.rs +++ b/tokio-xmpp/examples/contact_addr.rs @@ -14,6 +14,8 @@ use xmpp_parsers::{ #[tokio::main] async fn main() { + env_logger::init(); + let args: Vec = args().collect(); if args.len() != 4 { println!("Usage: {} ", args[0]); diff --git a/tokio-xmpp/examples/download_avatars.rs b/tokio-xmpp/examples/download_avatars.rs index 2af1580c..a5c8438a 100644 --- a/tokio-xmpp/examples/download_avatars.rs +++ b/tokio-xmpp/examples/download_avatars.rs @@ -27,6 +27,8 @@ use xmpp_parsers::{ #[tokio::main] async fn main() { + env_logger::init(); + let args: Vec = args().collect(); if args.len() != 3 { println!("Usage: {} ", args[0]); diff --git a/tokio-xmpp/examples/echo_bot.rs b/tokio-xmpp/examples/echo_bot.rs index eed8c2e6..7c07ec35 100644 --- a/tokio-xmpp/examples/echo_bot.rs +++ b/tokio-xmpp/examples/echo_bot.rs @@ -11,6 +11,8 @@ use xmpp_parsers::{BareJid, Element, Jid}; #[tokio::main] async fn main() { + env_logger::init(); + let args: Vec = args().collect(); if args.len() != 3 { println!("Usage: {} ", args[0]); diff --git a/tokio-xmpp/examples/echo_component.rs b/tokio-xmpp/examples/echo_component.rs index ef884430..832b2fd3 100644 --- a/tokio-xmpp/examples/echo_component.rs +++ b/tokio-xmpp/examples/echo_component.rs @@ -10,6 +10,8 @@ use xmpp_parsers::{Element, Jid}; #[tokio::main] async fn main() { + env_logger::init(); + let args: Vec = args().collect(); if args.len() < 3 || args.len() > 5 { println!("Usage: {} [server] [port]", args[0]); diff --git a/tokio-xmpp/examples/send_message.rs b/tokio-xmpp/examples/send_message.rs index 9c54a8bc..5b56989d 100644 --- a/tokio-xmpp/examples/send_message.rs +++ b/tokio-xmpp/examples/send_message.rs @@ -9,6 +9,8 @@ use xmpp_parsers::Jid; #[tokio::main] async fn main() { + env_logger::init(); + let args: Vec = args().collect(); if args.len() != 4 { println!("Usage: {} ", args[0]);