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

Fix logs to use inplace formatting in stacks node #5419

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

jferrant
Copy link
Collaborator

@jferrant jferrant commented Nov 2, 2024

This was more of a just try it out to see if its an improvement. There are many instances where I think it is. Should we introduce this as a general standard from now on?

@jferrant jferrant requested a review from a team as a code owner November 2, 2024 22:10
@jferrant jferrant mentioned this pull request Nov 2, 2024
@obycode
Copy link
Contributor

obycode commented Nov 4, 2024

If we're going to do this, maybe we should also use named parameters when the expression cannot be directly inserted in place. I find it a little less clear when there is a mix of empty {} and those with names in them. For example:

        test_debug!(
             "Miner {miner_id}: Block commit transaction builds on {parent_block_ptr},{parent_vtxindex} (parent snapshot is {parent_block_snapshot_opt:?})",
             miner_id = miner.id,
             parent_block_ptr = block_commit_op.parent_block_ptr,
             parent_vtxindex = block_commit_op.parent_vtxindex
         );

@jferrant
Copy link
Collaborator Author

jferrant commented Nov 4, 2024

If we're going to do this, maybe we should also use named parameters when the expression cannot be directly inserted in place. I find it a little less clear when there is a mix of empty {} and those with names in them. For example:

        test_debug!(
             "Miner {miner_id}: Block commit transaction builds on {parent_block_ptr},{parent_vtxindex} (parent snapshot is {parent_block_snapshot_opt:?})",
             miner_id = miner.id,
             parent_block_ptr = block_commit_op.parent_block_ptr,
             parent_vtxindex = block_commit_op.parent_vtxindex
         );

I agree. I think I should do this as well.

I am doing it as a blanket apply across all code, but don't think we have to be super strict about this. By no means should this prevent a PR merging, but I think we as a team should try introducing it as a best practice :)

@jferrant jferrant changed the base branch from chore/stacks-node-clippy to develop November 4, 2024 19:56
Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving provided all CI tests pass.

@jcnelson jcnelson self-requested a review November 5, 2024 22:19
@jferrant jferrant requested a review from obycode November 7, 2024 23:51
@jferrant jferrant added this pull request to the merge queue Nov 8, 2024
Merged via the queue into develop with commit f0e434f Nov 8, 2024
146 of 147 checks passed
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 this pull request may close these issues.

3 participants