Skip to content

feat(example_wallet_rpc): enhance logging with structured JSON output #1920

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

Closed
wants to merge 0 commits into from

Conversation

SharanRP
Copy link

Description

Enhanced the example_wallet_rpc to output information in JSON format instead of plain text. This change makes it easier to extract and process information using tools like jq, improving integration with shell scripts and external CLI tools.

Key changes:

  • Added JSON structured output for all logging/status messages
  • Added event types to distinguish different output messages
  • Maintained all existing functionality while only changing the output format
  • Added serde_json dependency for JSON serialization

Notes to the reviewers

The change is minimal and non-breaking - all the same information is being output, just in a structured JSON format. Each message includes an "event" field to easily identify the type of output, making it simpler to filter and process specific information.

The JSON format was chosen over other structured formats (like YAML) because:

  1. It's widely supported across all platforms
  2. Has excellent tooling support (jq, python json, etc.)
  3. Is easily parseable by most programming languages
  4. Maintains human readability with pretty printing

Changelog notice

Added:

  • JSON structured output format for example_wallet_rpc, enabling better integration with external tools and scripts

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@AmosOO7
Copy link

AmosOO7 commented Apr 1, 2025

Hello @SharanRP,
All the tests I’ve performed are working so far. The only issue I encountered was a formatting error when I ran the fmt check.

@SharanRP
Copy link
Author

SharanRP commented Apr 2, 2025

@AmosOO7 Alright, I’ll make the necessary fixes and push the patch.

@luisschwab
Copy link
Member

Hey @SharanRP, this PR needs to be closed and moved to the new bdk_wallet repo. Here's how:

  1. From your Github account, fork https://github.com/bitcoindevkit/bdk_wallet
  2. From your local system bdk repo folder, push your PR changes to your bdk_wallet fork on Github:
    git checkout <PR branch path>
    git push [email protected]:<username>/bdk_wallet.git
    
  3. Clone to your forked bdk_wallet repo to your local system and switch to your PR branch:
    git clone [email protected]:<username>/bdk_wallet.git
    cd bdk_wallet
    git fetch origin <PR branch path>
    git checkout -b <PR branch path> FETCH_HEAD
    git rebase master
    
  4. Resolve rebase conflicts (if any)
  5. Force push your PR branch: git push origin -f
  6. Create new PR in bitcoindevkit/bdk_wallet repo from your fork branch
  7. Copy/paste title and description from your original bdk PR and add a link back to it in your new PR.
  8. Close original PR with comment that includes link to new PR.

@SharanRP
Copy link
Author

@luisschwab I will make the changes and push the PR

@luisschwab
Copy link
Member

Thanks, don't forget to close this one.

@SharanRP SharanRP closed this Apr 24, 2025
@github-project-automation github-project-automation bot moved this from Discussion to Done in BDK Chain Apr 24, 2025
@SharanRP
Copy link
Author

This PR has been moved to the new bdk_wallet repo as requested: bdk_wallet PR #216

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

Successfully merging this pull request may close these issues.

3 participants