Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
node: Improve logging more
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Mar 22, 2024
1 parent a4928f5 commit ada492f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions radicle-fetch/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl FetchState {
)?;
log::debug!(
target: "fetch",
"Fetched data refs for {} remotes ({}ms)",
"Fetched data refs for {} remote(s) ({}ms)",
fetched.len(),
start.elapsed().as_millis()
);
Expand Down Expand Up @@ -562,7 +562,7 @@ impl FetchState {
}
log::debug!(
target: "fetch",
"Validated {} remotes ({}ms)",
"Validated {} remote(s) ({}ms)",
remotes.len(),
start.elapsed().as_millis()
);
Expand Down
2 changes: 2 additions & 0 deletions radicle-node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,8 @@ where
let peers = self.sessions.connected().map(|(_, p)| p);
let (ann, refs) = self.refs_announcement_for(rid, remotes)?;

debug!(target: "service", "Announcing refs for {rid} to peers..");

// Update our local sync status. This is useful for determining if refs were updated while
// the node was stopped.
if let Some(refs) = refs.iter().find(|r| r.remote == ann.node) {
Expand Down
13 changes: 12 additions & 1 deletion radicle-node/src/service/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Outbox {
}

pub fn write(&mut self, remote: &Session, msg: Message) {
msg.log(log::Level::Trace, &remote.id, Link::Outbound);
msg.log(log::Level::Debug, &remote.id, Link::Outbound);
trace!(target: "service", "Write {:?} to {}", &msg, remote);

self.io.push_back(Io::Write(remote.id, vec![msg]));
Expand All @@ -81,7 +81,18 @@ impl Outbox {
if let Some(subscribe) = &peer.subscribe {
if subscribe.filter.contains(&refs.rid) {
self.write(peer, ann.clone().into());
} else {
debug!(
target: "service",
"Skipping refs announcement relay to {peer}: peer isn't subscribed to {}",
refs.rid
);
}
} else {
debug!(
target: "service",
"Skipping refs announcement relay to {peer}: peer didn't send a subscription filter"
);
}
} else {
self.write(peer, ann.clone().into());
Expand Down

0 comments on commit ada492f

Please sign in to comment.