From 3e2b51f14826162baa8f475bf3419ddb5decce0b Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 18 Mar 2020 21:11:21 +0100 Subject: [PATCH] tokio-xmpp: improve error logging --- tokio-xmpp/src/xmpp_codec.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tokio-xmpp/src/xmpp_codec.rs b/tokio-xmpp/src/xmpp_codec.rs index cb956b3..9a8a409 100644 --- a/tokio-xmpp/src/xmpp_codec.rs +++ b/tokio-xmpp/src/xmpp_codec.rs @@ -2,7 +2,7 @@ use crate::{ParseError, ParserError}; use bytes::{BufMut, BytesMut}; -use log::debug; +use log::{debug, error}; use std; use std::borrow::Cow; use std::collections::vec_deque::VecDeque; @@ -250,7 +250,7 @@ impl Decoder for XMPPCodec { return result; } Err(e) => { - // println!("error {} at {}/{} in {:?}", e, e.valid_up_to(), buf1.len(), buf1); + error!("error {} at {}/{} in {:?}", e, e.valid_up_to(), buf1.len(), buf1); return Err(ParserError::Utf8(e)); } } @@ -309,7 +309,9 @@ impl Encoder for XMPPCodec { Ok(()) }) .map_err(to_io_err), - Packet::StreamEnd => write!(dst, "\n").map_err(to_io_err), + Packet::StreamEnd => + write!(dst, "\n") + .map_err(to_io_err), } } }