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

chore(docs): Aztec.nr logging page #3281

Merged
merged 1 commit into from
Nov 10, 2023
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
27 changes: 27 additions & 0 deletions docs/docs/dev_docs/debugging/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,31 @@ import DocCardList from '@theme/DocCardList';

On this section you can learn how to debug your Aztec.nr smart contracts and common errors that you may run into.

# Logging in Aztec.nr

You can log statements from Aztec.nr contracts that will show ups in the Sanbox.

**Import debug_log**
Import the [`debug_log`](https://github.com/AztecProtocol/aztec-packages/blob/master/yarn-project/aztec-nr/aztec/src/oracle/debug_log.nr) dependency from Aztec oracles:

```rust
use dep::aztec::oracle::debug_log::{ debug_log };
```

**Write log**
Write `debug_log()` in the appropriate place in your contract.

```rust
debug_log("here")
```

**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.

```bash
cd ~./aztec && DEBUG=aztec docker-compose up
```


<DocCardList/>