Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions docs/docs/dev_docs/debugging/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

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


```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
Copy link
Member

Choose a reason for hiding this comment

The 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/>