From 04d34f4b651ca4d9fb3d5e5a803419457618afee Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 26 Jun 2017 10:56:03 -0700 Subject: [PATCH] chore(lib) shuffle around some debug! and info! calls --- src/http/h1/parse.rs | 4 ++-- src/http/request.rs | 8 +++++--- src/http/response.rs | 10 ++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/http/h1/parse.rs b/src/http/h1/parse.rs index 8f1cae8d..6831c88d 100644 --- a/src/http/h1/parse.rs +++ b/src/http/h1/parse.rs @@ -109,10 +109,10 @@ impl Http1Transaction for ServerTransaction { } Encoder::chunked() }; + debug!("encode headers = {:?}", head.headers); let init_cap = 30 + head.headers.len() * AVERAGE_HEADER_SIZE; dst.reserve(init_cap); - debug!("writing headers = {:?}", head.headers); if head.version == ::HttpVersion::Http11 && head.subject == ::StatusCode::Ok { extend(dst, b"HTTP/1.1 200 OK\r\n"); let _ = write!(FastWrite(dst), "{}", head.headers); @@ -250,10 +250,10 @@ impl Http1Transaction for ClientTransaction { head.headers.set(TransferEncoding(vec![header::Encoding::Chunked])); } } + debug!("encode headers = {:?}", head.headers); let init_cap = 30 + head.headers.len() * AVERAGE_HEADER_SIZE; dst.reserve(init_cap); - debug!("writing {:#?}", head.headers); let _ = write!(FastWrite(dst), "{} {}\r\n{}\r\n", head.subject, head.version, head.headers); body diff --git a/src/http/request.rs b/src/http/request.rs index 6c057566..ddb869ba 100644 --- a/src/http/request.rs +++ b/src/http/request.rs @@ -137,8 +137,10 @@ struct MaybeAddr<'a>(&'a Option); impl<'a> fmt::Display for MaybeAddr<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self.0 { - Some(ref addr) => fmt::Display::fmt(addr, f), - None => f.write_str("None"), + Some(ref addr) => { + write!(f, "addr={}, ", addr) + }, + None => Ok(()), } } } @@ -146,7 +148,7 @@ impl<'a> fmt::Display for MaybeAddr<'a> { /// Constructs a request using a received ResponseHead and optional body pub fn from_wire(addr: Option, incoming: RequestHead, body: B) -> Request { let MessageHead { version, subject: RequestLine(method, uri), headers } = incoming; - debug!("Request::new: addr={}, req=\"{} {} {}\"", MaybeAddr(&addr), method, uri, version); + info!("Request::new: {}\"{} {} {}\"", MaybeAddr(&addr), method, uri, version); debug!("Request::new: headers={:?}", headers); Request:: { diff --git a/src/http/response.rs b/src/http/response.rs index c2dcf821..3611c0fd 100644 --- a/src/http/response.rs +++ b/src/http/response.rs @@ -143,9 +143,8 @@ impl fmt::Debug for Response { #[cfg(not(feature = "raw_status"))] pub fn from_wire(incoming: ResponseHead, body: Option) -> Response { let status = incoming.status(); - trace!("Response::new"); - debug!("version={:?}, status={:?}", incoming.version, status); - debug!("headers={:?}", incoming.headers); + info!("Response::new \"{} {}\"", incoming.version, status); + debug!("Response::new headers={:?}", incoming.headers); Response:: { status: status, @@ -160,9 +159,8 @@ pub fn from_wire(incoming: ResponseHead, body: Option) -> Response { #[cfg(feature = "raw_status")] pub fn from_wire(incoming: ResponseHead, body: Option) -> Response { let status = incoming.status(); - trace!("Response::new"); - debug!("version={:?}, status={:?}", incoming.version, status); - debug!("headers={:?}", incoming.headers); + info!("Response::new \"{} {}\"", incoming.version, status); + debug!("Response::new headers={:?}", incoming.headers); Response:: { status: status,