-
Notifications
You must be signed in to change notification settings - Fork 598
fix(docs): doc explaining noir debug_log #3322
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2726511
fix: doc explaining noir debug_log
spypsy 5d7018a
add docker-compose explanation
spypsy a8c08b6
add npm sandbox example
spypsy 70ca829
add docs for more log functions
spypsy bcbda07
Merge branch 'master' into spy/doc-typo
spypsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,19 +18,50 @@ use dep::aztec::oracle::debug_log::{ debug_log }; | |
| ``` | ||
|
|
||
| **Write log** | ||
| Write `debug_log()` in the appropriate place in your contract. | ||
|
|
||
| Write `debug_log()` in the appropriate place in your contract. | ||
|
|
||
| ```rust | ||
| debug_log("here") | ||
| debug_log("here"); | ||
| ``` | ||
|
|
||
| Other methods for logging include: | ||
|
|
||
| `debug_log_format()`: for logging Field values along arbitrary strings. | ||
|
|
||
| ```rust | ||
| debug_log_format("get_2(slot:{0}) =>\n\t0:{1}\n\t1:{2}", [storage_slot, note0_hash, note1_hash]); | ||
| ``` | ||
|
|
||
| `debug_log_field()`: for logging Fields. | ||
|
|
||
| ```rust | ||
| debug_log_field(my_field); | ||
| ``` | ||
|
|
||
| `debug_log_array()`: for logging array types. | ||
|
|
||
| ```rust | ||
| debug_log_array(my_array); | ||
| ``` | ||
|
|
||
| **Start Sandbox in debug mode** | ||
|
|
||
| Prepend the command to start the sandbox with `DEBUG=aztec` to log everything or `DEBUG=aztec:simulator:oracle` to only log your `debug_log()` statements. | ||
| Prepend the command to start the sandbox with `DEBUG=aztec:*` to log everything or `DEBUG=aztec:simulator:oracle` to only log your `debug_log()` statements. | ||
|
|
||
| ```bash | ||
| cd ~./aztec && DEBUG=aztec docker-compose up | ||
| # Using the docker-compose.yml setup | ||
| cd ~./aztec && DEBUG=aztec:* docker-compose up | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we assume the user has the docker compose file installed, when most will just be running the getting started script? Maybe we should also include an example for the npm sandbox flow |
||
|
|
||
| # or if you're using the npm package | ||
| DEBUG=aztec:* aztec-sandbox | ||
| ``` | ||
|
|
||
| Alternatively you can update the `DEBUG` environment variable in docker-compose.yml and start the sandbox normally. | ||
|
|
||
| ```yml | ||
| environment: | ||
| DEBUG: aztec:* | ||
| ``` | ||
|
|
||
| <DocCardList/> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include documentation on the various debug types, more often than not people want to just log a field element. This is not possible with the single debug log without using the templating syntax