]> git.lizzy.rs Git - connect-rs.git/commitdiff
lower the log level of debug stmts to trace
authorSachandhan Ganesh <sachan.ganesh@gmail.com>
Fri, 15 Jan 2021 21:31:13 +0000 (13:31 -0800)
committerSachandhan Ganesh <sachan.ganesh@gmail.com>
Fri, 15 Jan 2021 21:31:13 +0000 (13:31 -0800)
src/reader.rs
src/tcp/server.rs
src/tls/server.rs
src/writer.rs

index 1dd9f98145b03ad8f285ba835470048e7196150a..8dcb089c194f1883bb98708f9bd57500787e59fe 100644 (file)
@@ -51,17 +51,17 @@ impl Stream for ConnectionReader {
         let mut buffer = BytesMut::new();
         buffer.resize(BUFFER_SIZE, 0);
 
-        debug!("Starting new read loop for {}", self.local_addr);
+        trace!("Starting new read loop for {}", self.local_addr);
         loop {
             trace!("Reading from the stream");
             match futures::executor::block_on(self.read_stream.read(&mut buffer)) {
                 Ok(mut bytes_read) => {
                     if bytes_read > 0 {
-                        debug!("Read {} bytes from the network stream", bytes_read)
+                        trace!("Read {} bytes from the network stream", bytes_read)
                     }
 
                     if let Some(mut pending_buf) = self.pending_read.take() {
-                        debug!("Prepending broken data ({} bytes) encountered from earlier read of network stream", pending_buf.len());
+                        trace!("Prepending broken data ({} bytes) encountered from earlier read of network stream", pending_buf.len());
                         bytes_read += pending_buf.len();
 
                         pending_buf.unsplit(buffer);
@@ -72,18 +72,17 @@ impl Stream for ConnectionReader {
                         format!("Conversion from usize ({}) to u64 failed", bytes_read).as_str(),
                     );
                     while bytes_read_u64 > 0 {
-                        debug!(
+                        trace!(
                             "{} bytes from network stream still unprocessed",
                             bytes_read_u64
                         );
 
                         buffer.resize(bytes_read, 0);
-                        debug!("{:?}", buffer.as_ref());
 
                         match ConnectionMessage::parse_from_bytes(buffer.as_ref()) {
                             Ok(mut data) => {
                                 let serialized_size = data.compute_size();
-                                debug!("Deserialized message of size {} bytes", serialized_size);
+                                trace!("Deserialized message of size {} bytes", serialized_size);
 
                                 buffer.advance(serialized_size as usize);
 
@@ -95,9 +94,9 @@ impl Stream for ConnectionReader {
                                     .as_str(),
                                 );
                                 bytes_read_u64 -= serialized_size_u64;
-                                debug!("{} bytes still unprocessed", bytes_read_u64);
+                                trace!("{} bytes still unprocessed", bytes_read_u64);
 
-                                debug!("Sending deserialized message downstream");
+                                trace!("Sending deserialized message downstream");
                                 return Poll::Ready(Some(data.take_payload()));
                             }
 
index 136c3f1a37e118308358f1111dc5f68d589cda25..09c51d1f03f9739787dff8c3a676a375e9a4891a 100644 (file)
@@ -36,7 +36,7 @@ impl Stream for TcpServer {
             );
             Poll::Ready(Some(Connection::from(conn)))
         } else {
-            debug!("Shutting TCP server down at {}", self.local_addrs);
+            info!("Shutting TCP server down at {}", self.local_addrs);
             Poll::Ready(None)
         }
     }
index cfd06f88a11ee79fed57ccd8a6c4a6245dce433a..4d92e2ee109bab8606ce75b34475e051ff643b87 100644 (file)
@@ -53,11 +53,11 @@ impl Stream for TlsServer {
                     stream: tls_stream,
                 })))
             } else {
-                debug!("Could not encrypt connection with TLS from {}", peer_addr);
+                warn!("Could not encrypt connection with TLS from {}", peer_addr);
                 Poll::Pending
             }
         } else {
-            debug!("Shutting TLS server down at {}", self.local_addrs);
+            info!("Shutting TLS server down at {}", self.local_addrs);
             Poll::Ready(None)
         }
     }
index c2275ac9d39b45866ae5ef10d0ed947d1dcab686..5b5b17a99102a1539f9349d07643354aa5fa4b4e 100644 (file)
@@ -45,16 +45,16 @@ impl<T: Message> Sink<T> for ConnectionWriter {
 
     fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
         if self.pending_write.is_some() {
-            debug!("Connection not ready to send message yet, waiting for prior message");
+            trace!("Connection not ready to send message yet, waiting for prior message");
             Poll::Pending
         } else {
-            debug!("Connection ready to send message");
+            trace!("Connection ready to send message");
             Poll::Ready(Ok(()))
         }
     }
 
     fn start_send(mut self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
-        debug!("Preparing message to be sent next");
+        trace!("Preparing message to be sent next");
         let stitch_msg: ConnectionMessage = ConnectionMessage::from_msg(item);
         self.pending_write.replace(stitch_msg);
 
@@ -66,33 +66,33 @@ impl<T: Message> Sink<T> for ConnectionWriter {
         _cx: &mut Context<'_>,
     ) -> Poll<Result<(), Self::Error>> {
         if let Some(pending_msg) = self.pending_write.take() {
-            debug!("Send pending message");
+            trace!("Send pending message");
             if let Ok(buffer) = pending_msg.write_to_bytes() {
                 let msg_size = buffer.len();
-                debug!("{} bytes to be sent over network connection", msg_size);
+                trace!("{} bytes to be sent over network connection", msg_size);
 
-                debug!("{:?}", buffer.as_slice());
+                trace!("{:?}", buffer.as_slice());
 
                 return if let Ok(_) =
                     futures::executor::block_on(self.write_stream.write_all(buffer.as_slice()))
                 {
                     if let Ok(_) = futures::executor::block_on(self.write_stream.flush()) {
-                        debug!("Sent message of {} bytes", msg_size);
+                        trace!("Sent message of {} bytes", msg_size);
                         Poll::Ready(Ok(()))
                     } else {
-                        debug!("Encountered error while flushing queued bytes to network stream");
+                        trace!("Encountered error while flushing queued bytes to network stream");
                         Poll::Ready(Err(RecvError))
                     }
                 } else {
-                    debug!("Encountered error when writing to network stream");
+                    error!("Encountered error when writing to network stream");
                     Poll::Ready(Err(RecvError))
                 };
             } else {
-                debug!("Encountered error when serializing message to bytes");
+                error!("Encountered error when serializing message to bytes");
                 return Poll::Ready(Err(RecvError));
             }
         } else {
-            debug!("No message to send over connection");
+            trace!("No message to send over connection");
         }
 
         Poll::Ready(Ok(()))