refactor: logging environment variables - #43
Open
yCodeTech wants to merge 4 commits into
Open
Conversation
…s.env. The env variables could potentially have some sensitive information, so we shouldn't dump all env vars. The majority of them don't seem to be useful for debugging anyway. - Removed dumping `process.env`.
- Added handpicked env vars to be logged in `logDebugInfo` Configuration method:
- VScode's `appRoot` env var.
- Env vars that start with `VSCODE_` in `process.env`.
- Removed logging of the extension discovery paths as they are already logged from the extension file, so these are redundant. - Added code comments to the various debug logs to make it easier to scan read.
There was a problem hiding this comment.
Pull request overview
This PR refactors Configuration.logDebugInfo() to adjust what environment-related information is emitted in debug logs, focusing on VS Code-specific environment details rather than dumping broad environment state.
Changes:
- Removed logging of extension discovery paths (including WSL-specific paths) from the debug “Environment” payload.
- Added logging of
vscode.env.appRootand a filtered set ofprocess.enventries limited toVSCODE_*variables. - Reorganized debug-log sections with additional inline headings for language config-related logs.
`process.env` values are typed as `string|undefined` and `undefined` isn't assignable to `JsonValue` in the `JsonObject` of the env object. So we need a type predicate to make sure the entry IS string, and a type guard to discard any values that are undefined. - Fixed the logging of environment variables filter to ensure that only string values are included for keys starting with "VSCODE_".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the way environment and extension path information is logged in the
Configurationclass, streamlining the debug output and focusing on relevant environment variables. The most important changes are:Environment and Extension Path Logging:
logDebugInfomethod as these are also logged inextension.ts, so they're technically redundant in the method.App Rootand filtered environment variables (only those starting withVSCODE_) underEnv Varsin the environment details, making the debug output more focused and relevant inlogDebugInfomethod.Removal of dumping system environment variables into the logs