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

Render Stellar Events as JSON Instead of Rust Debug Format and Update WASM Path #1642

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

juandiegocv27
Copy link

What

This PR modifies the Stellar events output to render as JSON instead of using the Rust debug format. Additionally, it updates the path in boilerplate.rs for including the WASM file.

Why

The change is being made because developers are more familiar with the JSON format, which provides a standardized way of viewing event data. It aligns with Render events as json in stellar events pretty output instead of as rust debug issue, aiming to improve the readability and usability of the event logs for developers.

@juandiegocv27
Copy link
Author

juandiegocv27 commented Oct 2, 2024

ready for review: @leighmcculloch, please tell me if there a telegram group instead of the discord for more fluent conversation about this issue please

Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Hi @juandiegocv27, thanks for contributing.

See my comments inline.

Comment on lines -18 to +22
let xdr = event.to_xdr_base64(xdr::Limits::none()).unwrap();
// Convert the event to JSON
let json = serde_json::to_string(event).unwrap();

if span.metadata().unwrap().level() == &Level::INFO {
info!("{i}: {xdr} {json}");
info!("{i}: {json}");
} else {
debug!("{i}: {xdr} {json}");
debug!("{i}: {json}");
Copy link
Member

@leighmcculloch leighmcculloch Oct 2, 2024

Choose a reason for hiding this comment

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

This output is part of the logging and it was just recently written to output both the XDR and the JSON in the following issue. We want to keep it as is:

The issue being addressed by this PR is to change the stdout output of the stellar contract events subcommand, not the log output. If you see the original issue the original issue has an example of what the command is to run, and what the output looks like today. It's that output that the issue describes being changed from Rust debug format to JSON.

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

Successfully merging this pull request may close these issues.

Render events as json in stellar events pretty output instead of as rust debug
2 participants