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

Refactor handling of logging and user messaging. #37

Merged
merged 7 commits into from
Dec 30, 2022
Merged

Refactor handling of logging and user messaging. #37

merged 7 commits into from
Dec 30, 2022

Conversation

noppej
Copy link
Contributor

@noppej noppej commented Dec 15, 2022

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

@noppej noppej requested a review from Yatekii December 16, 2022 17:36
@noppej noppej changed the title WIP: Refactor handling of logging and user messaging. Refactor handling of logging and user messaging. Dec 16, 2022
@noppej noppej marked this pull request as ready for review December 16, 2022 17:37
@noppej noppej marked this pull request as draft December 16, 2022 18:00
@noppej noppej marked this pull request as ready for review December 16, 2022 18:35
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
@Yatekii
Copy link
Member

Yatekii commented Dec 27, 2022

I added a few nits that are not a must but would be nice :)

noppej and others added 3 commits December 28, 2022 10:08
Co-authored-by: Noah Hüsser <Yatekii@users.noreply.github.com>
Co-authored-by: Noah Hüsser <Yatekii@users.noreply.github.com>
Co-authored-by: Noah Hüsser <Yatekii@users.noreply.github.com>
@noppej
Copy link
Contributor Author

noppej commented Dec 28, 2022

I added a few nits that are not a must but would be nice :)

Much appreciated ... nits or not, they help improve code quality, and worth the few minutes it takes to address. Thanks !

@noppej noppej requested a review from Yatekii December 29, 2022 00:13
bors bot added a commit to probe-rs/probe-rs that referenced this pull request Dec 30, 2022
1334: Refactor handling of logging and user messaging in `probe-rs-debugger` r=Yatekii a=noppej

Please see (and synchronize merge with): [VSCode PR#37](probe-rs/vscode#37)

Co-authored-by: JackN <noppej@hotmail.com>
Copy link
Member

@Yatekii Yatekii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 30, 2022

Build succeeded:

@bors bors bot merged commit 4291276 into master Dec 30, 2022
@bors bors bot deleted the updates branch December 30, 2022 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants