chore(lib) shuffle around some debug! and info! calls

This commit is contained in:
Sean McArthur
2017-06-26 10:56:03 -07:00
parent 3d85ad057c
commit 04d34f4b65
3 changed files with 11 additions and 11 deletions

View File

@@ -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

View File

@@ -137,8 +137,10 @@ struct MaybeAddr<'a>(&'a Option<SocketAddr>);
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<B>(addr: Option<SocketAddr>, incoming: RequestHead, body: B) -> Request<B> {
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::<B> {

View File

@@ -143,9 +143,8 @@ impl fmt::Debug for Response {
#[cfg(not(feature = "raw_status"))]
pub fn from_wire<B>(incoming: ResponseHead, body: Option<B>) -> Response<B> {
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::<B> {
status: status,
@@ -160,9 +159,8 @@ pub fn from_wire<B>(incoming: ResponseHead, body: Option<B>) -> Response<B> {
#[cfg(feature = "raw_status")]
pub fn from_wire<B>(incoming: ResponseHead, body: Option<B>) -> Response<B> {
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::<B> {
status: status,