Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enr Debug implementation is unhelpful #13

Closed
mattsse opened this issue Dec 15, 2022 · 2 comments · Fixed by #15
Closed

Enr Debug implementation is unhelpful #13

mattsse opened this issue Dec 15, 2022 · 2 comments · Fixed by #15

Comments

@mattsse
Copy link
Contributor

mattsse commented Dec 15, 2022

The current debug impl of Enr

enr/src/lib.rs

Lines 864 to 868 in e59dcb4

impl<K: EnrKey> std::fmt::Debug for Enr<K> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.to_base64())
}
}

is unhelpful for debugging.

The display impl is more helpful for debugging but lacks content info

enr/src/lib.rs

Lines 852 to 862 in e59dcb4

impl<K: EnrKey> std::fmt::Display for Enr<K> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
"ENR: NodeId: {}, IpV4 Socket: {:?} IpV6 Socket: {:?}",
self.node_id(),
self.udp4_socket(),
self.udp6_socket()
)
}
}

Suggest flipping them and to include k,v pairs as well.

@divagant-martian
Copy link
Collaborator

Sounds like a good suggestion! Are you planning on providing a PR for this?

@mattsse
Copy link
Contributor Author

mattsse commented Dec 16, 2022

great, will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants