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

kad: impl Display on QueryId #4813

Closed
stormshield-frb opened this issue Nov 7, 2023 · 0 comments · Fixed by #4814
Closed

kad: impl Display on QueryId #4813

stormshield-frb opened this issue Nov 7, 2023 · 0 comments · Fixed by #4814

Comments

@stormshield-frb
Copy link
Contributor

Description

Currently, only Debug is implemented on protocols::kad::src::query.rs::QueryId. It would be great to also add a Display implementation for logging purposes, for example.

Motivation

For logging purposes, we would like to get (using tracing) something like query_id=3 instead of what is currently done query_id=QueryId(3).

Indeed, since only Debug implemented, we currently have to do debug!(?query_id, "Got a query") which render query_id=QueryId(3).

We would like to be able to do debug!(%query_id, "Got a query") to get query_id=3 which would be shorter and cleaner.

Requirements

  1. implement std::fmt::Display on protocols::kad::src::query.rs::QueryId: format!("{}", QueryId(3)) should return "3".

Open questions

No response

Are you planning to do it yourself in a pull request ?

Yes

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.

1 participant