From eed023d2f8c642ee1dab8c9910d7a1651622070c Mon Sep 17 00:00:00 2001 From: spypsy Date: Mon, 27 Nov 2023 15:51:38 +0000 Subject: [PATCH] fix(docs): doc explaining noir debug_log (#3322) Fixes https://github.com/AztecProtocol/aztec-packages/issues/3179 --- docs/docs/dev_docs/debugging/main.md | 39 +++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/docs/dev_docs/debugging/main.md b/docs/docs/dev_docs/debugging/main.md index e57d052693d..3b343efec0d 100644 --- a/docs/docs/dev_docs/debugging/main.md +++ b/docs/docs/dev_docs/debugging/main.md @@ -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 + +# 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:* +```