Skip to content

Commit

Permalink
improve hash formatting in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
zeegomo committed Sep 24, 2021
1 parent 79eecad commit 830c868
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jormungandr/src/fragment/selection.rs
Expand Up @@ -159,7 +159,7 @@ impl FragmentSelectionAlgorithm for OldestFirst {
let hard_deadline_future = hard_deadline_future.shared();
while let Some(fragment) = pool.remove_oldest() {
let id = fragment.id();
let span = debug_span!("fragment", hash=%id.to_string());
let span = debug_span!("fragment", hash=%id.to_string()[..7]);

async {
let result = try_apply_fragment(
Expand Down
4 changes: 2 additions & 2 deletions jormungandr/src/network/mod.rs
Expand Up @@ -384,7 +384,7 @@ async fn handle_propagation_msg(
let prop_state = state.clone();
let unreached_nodes = match &msg {
PropagateMsg::Block(header) => {
Span::current().record("hash", &header.hash().to_string().as_str());
Span::current().record("hash", &format_args!("{}", header.description()));
tracing::debug!("received new block to propagate");
let header = header.encode();
propagate_message(
Expand All @@ -398,7 +398,7 @@ async fn handle_propagation_msg(
.await?
}
PropagateMsg::Fragment(fragment) => {
Span::current().record("hash", &fragment.hash().to_string().as_str());
Span::current().record("hash", &format_args!("{:.8}", fragment.hash()));
tracing::debug!(hash = %fragment.hash(), "fragment to propagate");
let fragment = fragment.encode();
propagate_message(
Expand Down

0 comments on commit 830c868

Please sign in to comment.