Skip to content

Commit d87ead8

Browse files
authored
[chore] Document how logging works (#964)
This is implied throughout our usage. Codify what the actual flow is and how it works.
1 parent 8b20e46 commit d87ead8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,36 @@ You can also use the standard `cargo test` command if you really want:
7272
```bash
7373
cargo test
7474
```
75+
76+
## Logging and Output
77+
78+
### Tracing Library
79+
80+
The `tracing` library is used for:
81+
82+
- **Sentry reporting**: Errors and warnings are automatically sent to Sentry for monitoring and debugging
83+
- **Debug logging**: Internal debug information that helps with development and troubleshooting
84+
85+
**Important**: Tracing output does **not** surface to users unless they use the `--verbose` flag. By default, no tracing messages are shown in the console. They are primarily for Sentry reporting and debugging.
86+
87+
### Superconsole
88+
89+
The `superconsole` library is used for **surfacing information to users**. This is the primary mechanism for displaying:
90+
91+
- Progress messages
92+
- Status updates
93+
- Final results
94+
- User-facing error messages
95+
96+
### Error Handling
97+
98+
When errors occur:
99+
100+
1. **Always capture errors with `tracing::error!()`** - This ensures errors are logged to Sentry for monitoring
101+
2. **Surface blocking errors to users via `superconsole`** - If an error blocks execution, it should be displayed to the user through the display system (see `cli/src/error_report.rs` for examples)
102+
103+
The pattern is:
104+
105+
- Use `tracing` for observability and debugging (Sentry + optional verbose output)
106+
- Use `superconsole` for user-facing communication
107+
- Errors that block execution should use both: `tracing` for logging and `superconsole` for user display

0 commit comments

Comments
 (0)