rsnext/packages
Justin Ridgewell 4851e09ca8 Revamp errors and logging (vercel/turbo#467)
This updates all of our Issues to have a consistent display, and changes the way we display source code and debug-level details. In particular, this makes the following changes:

1. Cleans up the title/description of existing issues
   - We were filling the `title` field with too much information, because the `desccription` field wasn't always shown.
1. Always displays the `description`
   - This used to be hidden behind the `--detail` flag
1. Always displays the code frame of the issue, if it exists
   - This used to be hidden behind the `--detail` flag
1. Fixes the `context` (file path) to display the relative path to the file
   - It was hardcoded to the FS string used by turbotrace
1. Creates a new `detail` function which can provide debug-level information about the internal Rust state
   - This is not shown by default, user must pass `--detail` flag

The format for a rendered issue roughly matches:

```
${SEVERITY} [${CATEGORY}]
  ${CONTEXT}
    ${TITLE}
    ${CODE FRAME}
    ${DESCRIPTION}
    ${DETAIL}
```

Where
- `SEVERITY` is error/warning/etc
- `CATEGORY` is a self-defined string for the phase of the compiler (eg, "parsing", "running")
- `CONTEXT` is a file path to the offending file
- `TITLE` is a short (single-line) title
- `CODE_FRAME` is an optional position that generated the issue, which will display a few context lines and highlight the offending span of code
- `DESCRIPTION` is a longer (multi-line) message that describes the issue, and what to do about it
- `DETAIL` is a (by default not shown) fully detailed, debug-level, message providing insights into the internal state of Rust
2022-10-10 06:24:54 +00:00
..
next-swc/crates Revamp errors and logging (vercel/turbo#467) 2022-10-10 06:24:54 +00:00