Skip to content

Commit

Permalink
Merge #37
Browse files Browse the repository at this point in the history
37: Refactor handling of logging and user messaging. r=Yatekii a=noppej

`probe-rs` recently adopted the `tracing` crate for logging. This opened up the possibility to cleanup how logging was implemented in the VSCode extension and associated `probe-rs-debugger`. 

This PR will do the following:
- As a maintenance task, update the extension dependencies, and bump the version number.
- Add a `launch.json` setting to direct `probe-rs` logging to a JSON file, which can later be analyzed with [the log viewer](https://github.com/probe-rs/log-viewer).
- Remove any `probe-rs` (RUST_LOG) logging from the data being reported in the VSCode debug console. It is currently interspersed with debug adapter logging, and although somewhat informative, it makes it less than useful when analyzing `probe-rs` specific issues.
- Refactor the VSCode extension and `probe-rs-debugger` handling of MS DAP events and messages, to be more useful (objective opinion) to users of the extension.
- `probe-rs-debugger` logging will happen according to these rules:
  1. If the RUST_LOG environment variable is set, use it as a `LevelFilter` to configure a subscriber that logs to a file in the system's application data directory.
  2. Irrespective of theRUST_LOG environment variable, configure a subscriber that will write with `LevelFilter::ERROR` to stderr (because these errors are picked up and reported to the user by the VSCode extension).

**NOTE** This release requires changes to the `launch.json` files in user projects
- The `consoleLog` property only supports one of three values `[Console, Info, Debug]`
- The extension will now honour `env` properties, for example:
  ```
  "env": {
      "RUST_LOG": "warn",
      "DEFMT_LOG": "debug"
  }
  ```

For testing, feel free to use the [extension binary](https://github.com/probe-rs/vscode/releases/tag/v0.4.1)




Co-authored-by: JackN <noppej@hotmail.com>
  • Loading branch information
bors[bot] and noppej authored Dec 30, 2022
2 parents 3f7ae81 + e104a0c commit 4291276
Show file tree
Hide file tree
Showing 4 changed files with 660 additions and 530 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"amodio.tsl-problem-matcher"
"amodio.tsl-problem-matcher",
"ms-vscode.hexeditor"
]
}
Loading

0 comments on commit 4291276

Please sign in to comment.