Skip to content

feat: comprehensive logging overhaul for better debugging and diagnostics#1488

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/overhaul-logging-for-debugging
Draft

feat: comprehensive logging overhaul for better debugging and diagnostics#1488
Copilot wants to merge 1 commit intomainfrom
copilot/overhaul-logging-for-debugging

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

Summary

Overhauls logging across the extension to make debugging environment discovery and startup issues much easier for users and maintainers. The goal is that when something goes wrong (environments not found, startup stuck, selection not persisting), the Output panel logs tell a clear story of what happened and where.

Changes (10 files, +47/-25 lines)

1. Extension initialization progress (extension.ts)

Added traceInfo at each stage boundary with timing so users can see exactly where startup gets stuck:

  • Native finder initialization start/complete with duration
  • Manager registration start/complete
  • Environment selection start/complete
  • Final "Extension setup complete" with total time

2. Discovery START/END logging (internal.api.ts)

Every discovery operation now unconditionally logs:

  • [Manager] Discovering environments... at start
  • [Manager] Discovery complete: N environments found (X.Xs) at end
  • (Previously only logged when slow >15s or on failure)

3. Fixed wrong log levels

  • uvPythonInstaller.ts: traceErrortraceWarn for curl/wget fallback (not an error)
  • nativePythonFinder.ts: traceErrortraceWarn for global-level workspace setting (config issue, not runtime error)
  • envCommands.ts: traceInfotraceVerbose for clipboard copy operations (too minor for info)

4. Error context disambiguation (terminalEnvVarInjector.ts)

4 previously identical "Failed to update environment variables" error messages now have distinguishing context: (global reload), (no workspace folder for URI), for workspace: <name>, (settings change)

5. Environment creation logging (envCommands.ts)

createEnvironmentCommand and createAnyEnvironmentCommand now log on success with the environment name.

6. Environment selection logging (envManagers.ts)

setEnvironment promoted from traceVerbose to traceInfo and logs unconditionally (not just when persisting settings), showing env name, ID, scope, and manager.

7. Pyenv discovery parity (pyenvUtils.ts)

Added discovery source logging to match other managers (conda, pipenv, poetry): PYENV_ROOT, home directory, pyenv-win, PATH lookup, and "not found" message. Also logs discovery count.

8. Discovery summary enhancement (telemetry/helpers.ts)

logDiscoverySummary now includes ALL managers in the summary (even those with 0 environments or errors), making it clear which managers were checked.

Validation

  • ✅ Lint clean
  • ✅ Type check clean
  • ✅ 983 unit tests passing
  • ✅ Code review passed
  • ✅ CodeQL security scan passed

- Add extension initialization progress logging (native finder, manager
  registration, env selection, setup complete with timings)
- Add discovery START/END logging in InternalEnvironmentManager.refresh()
- Fix wrong log levels: traceError→traceWarn for non-error conditions
  (uvPythonInstaller, nativePythonFinder), traceInfo→traceVerbose for
  clipboard operations
- Add distinguishing context to terminal env var injector catch handlers
- Add environment creation logging in envCommands
- Promote setEnvironment logging to traceInfo and log unconditionally
- Add pyenv discovery source logging for all lookup paths
- Enhance discovery summary to include managers with 0 environments
- Update tests to match traceError→traceWarn change

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
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