reduce noisy test logs

This commit is contained in:
Igor Katson 2024-08-28 17:44:46 +01:00
parent e47134a45e
commit 9f798696ff
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
5 changed files with 12 additions and 10 deletions

View file

@ -199,9 +199,10 @@ impl<H: PeerConnectionHandler> PeerConnection<H> {
.await
.context("error reading handshake")?;
let h_supports_extended = h.supports_extended();
debug!(
"connected: id={:?}",
try_decode_peer_id(Id20::new(h.peer_id))
trace!(
peer_id=?h.peer_id,
decoded_id=?try_decode_peer_id(Id20::new(h.peer_id)),
"connected",
);
if h.info_hash != self.info_hash.0 {
anyhow::bail!("info hash does not match");

View file

@ -74,7 +74,7 @@ struct ParsedTorrentFile {
}
fn torrent_from_bytes(bytes: Bytes) -> anyhow::Result<ParsedTorrentFile> {
debug!(
trace!(
"all fields in torrent: {:#?}",
bencode::dyn_from_bytes::<ByteBuf>(&bytes)
);

View file

@ -10,7 +10,7 @@ use librqbit_core::Id20;
use parking_lot::RwLock;
use rand::{thread_rng, Rng, RngCore, SeedableRng};
use tempfile::TempDir;
use tracing::{debug, info};
use tracing::{info, trace};
pub fn setup_test_logging() {
if std::env::var("RUST_LOG").is_err() {
@ -26,7 +26,7 @@ pub fn create_new_file_with_random_content(path: &Path, mut size: usize) {
.open(path)
.unwrap();
debug!(?path, "creating temp file");
trace!(?path, "creating temp file");
const BUF_SIZE: usize = 8192 * 16;
let mut rng = rand::rngs::SmallRng::from_entropy();

View file

@ -979,7 +979,7 @@ impl PeerHandler {
PeerState::Live(live) => {
let mut g = self.state.lock_write("mark_chunk_requests_canceled");
for req in live.inflight_requests {
debug!(
trace!(
"peer dead, marking chunk request cancelled, index={}, chunk={}",
req.piece_index.get(),
req.chunk_index
@ -1036,9 +1036,9 @@ impl PeerHandler {
duration = format!("{dur:?}")
),
async move {
debug!("waiting to reconnect again");
trace!("waiting to reconnect again");
tokio::time::sleep(dur).await;
debug!("finished waiting");
trace!("finished waiting");
self.state
.peers
.with_peer_mut(handle, "dead_to_queued", |peer| {

View file

@ -32,6 +32,7 @@ use tokio_stream::StreamExt;
use tokio_util::sync::CancellationToken;
use tracing::debug;
use tracing::error_span;
use tracing::trace;
use tracing::warn;
use crate::chunk_tracker::ChunkTracker;
@ -271,7 +272,7 @@ impl ManagedTorrent {
loop {
match timeout(Duration::from_secs(5), peer_rx.next()).await {
Ok(Some(peer)) => {
debug!(?peer, "received peer from peer_rx");
trace!(?peer, "received peer from peer_rx");
let live = match live.upgrade() {
Some(live) => live,
None => return Ok(()),