feat(lib): switch from log to tracing (#475)

This commit is contained in:
David Barsky
2020-07-07 18:55:24 -04:00
committed by GitHub
parent d6fa8386c4
commit d3b9f1e36a
29 changed files with 179 additions and 176 deletions

View File

@@ -106,7 +106,7 @@ where
// Ensure that we have enough capacity to accept the write.
assert!(self.has_capacity());
log::debug!("send; frame={:?}", item);
tracing::debug!("send; frame={:?}", item);
match item {
Frame::Data(mut v) => {
@@ -150,31 +150,31 @@ where
}
Frame::Settings(v) => {
v.encode(self.buf.get_mut());
log::trace!("encoded settings; rem={:?}", self.buf.remaining());
tracing::trace!("encoded settings; rem={:?}", self.buf.remaining());
}
Frame::GoAway(v) => {
v.encode(self.buf.get_mut());
log::trace!("encoded go_away; rem={:?}", self.buf.remaining());
tracing::trace!("encoded go_away; rem={:?}", self.buf.remaining());
}
Frame::Ping(v) => {
v.encode(self.buf.get_mut());
log::trace!("encoded ping; rem={:?}", self.buf.remaining());
tracing::trace!("encoded ping; rem={:?}", self.buf.remaining());
}
Frame::WindowUpdate(v) => {
v.encode(self.buf.get_mut());
log::trace!("encoded window_update; rem={:?}", self.buf.remaining());
tracing::trace!("encoded window_update; rem={:?}", self.buf.remaining());
}
Frame::Priority(_) => {
/*
v.encode(self.buf.get_mut());
log::trace!("encoded priority; rem={:?}", self.buf.remaining());
tracing::trace!("encoded priority; rem={:?}", self.buf.remaining());
*/
unimplemented!();
}
Frame::Reset(v) => {
v.encode(self.buf.get_mut());
log::trace!("encoded reset; rem={:?}", self.buf.remaining());
tracing::trace!("encoded reset; rem={:?}", self.buf.remaining());
}
}
@@ -183,18 +183,18 @@ where
/// Flush buffered data to the wire
pub fn flush(&mut self, cx: &mut Context) -> Poll<io::Result<()>> {
log::trace!("flush");
tracing::trace!("flush");
loop {
while !self.is_empty() {
match self.next {
Some(Next::Data(ref mut frame)) => {
log::trace!(" -> queued data frame");
tracing::trace!(" -> queued data frame");
let mut buf = (&mut self.buf).chain(frame.payload_mut());
ready!(Pin::new(&mut self.inner).poll_write_buf(cx, &mut buf))?;
}
_ => {
log::trace!(" -> not a queued data frame");
tracing::trace!(" -> not a queued data frame");
ready!(Pin::new(&mut self.inner).poll_write_buf(cx, &mut self.buf))?;
}
}
@@ -234,7 +234,7 @@ where
}
}
log::trace!("flushing buffer");
tracing::trace!("flushing buffer");
// Flush the upstream
ready!(Pin::new(&mut self.inner).poll_flush(cx))?;