-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add enhanced logging feature for troubleshooting #8104
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
Conversation
- Add enhancedLoggingEnabled toggle in Settings → Info (About) section - Create logEnhancedError and logEnhanced utility functions - Add sanitization for sensitive data in logs - Integrate enhanced logging into API error handling - Add yellow warning banner when enhanced logging is enabled - Add comprehensive test coverage for logging functionality - Export disposeEnhancedLogging for proper cleanup Implements #8098
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed my own code and found it surprisingly coherent. Must be a bug in the review process.
| if (error.stack) { | ||
| channel.appendLine("") | ||
| channel.appendLine("Stack Trace:") | ||
| channel.appendLine(error.stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding rate limiting here to prevent log flooding. If errors occur in a tight loop, this could generate massive amounts of log data. Maybe implement a simple throttle mechanism or circular buffer?
| channel.appendLine(`Provider: ${additionalContext.provider}`) | ||
| } | ||
|
|
||
| if (additionalContext?.model) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice security implementation with the sanitization! Consider adding JSDoc comments to document the log output format. This would help developers understand what to expect when reading the logs:
| provider?: string | ||
| model?: string | ||
| request?: any | ||
| response?: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sanitization pattern is good, but have you considered making the redaction length configurable? Some users might prefer seeing more or fewer characters for debugging purposes.
| }) | ||
| } | ||
|
|
||
| if (!enhancedLoggingEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a "Copy Recent Logs" button here alongside the close button. This would make it easier for users to quickly grab logs for bug reports without navigating to the Output panel.
| const provider = this.providerRef.deref() | ||
| if (provider && !this.abort) { | ||
| logEnhancedError(provider.context, error, { | ||
| operation: "API Stream Processing", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good integration point! Consider adding log levels (ERROR, WARN, INFO) in the future for more granular control. Users might want to log only critical errors vs all API interactions.
This PR implements the enhanced logging feature requested in Issue #8098.
Summary
Adds a global "Enhanced logging" toggle to the Settings → Info (About) section that enables detailed failure logs to be written to the VS Code Output panel for troubleshooting purposes.
Changes
enhancedLoggingEnabledtoggle in Settings → Info (About) sectionlogEnhancedErrorandlogEnhancedutility functions for detailed loggingSecurity Considerations
Testing
Screenshots
When enabled, users will see:
Fixes #8098
Important
This PR adds an enhanced logging feature for detailed error logging and troubleshooting, with UI integration and comprehensive test coverage.
enhancedLoggingEnabledtoggle inglobal-settings.tsandwebviewMessageHandler.ts.logEnhancedErrorandlogEnhancedfunctions inenhancedLogging.tsfor detailed logging.Task.tsfor API error handling.ChatView.tsxwhen enhanced logging is enabled.EnhancedLoggingBannercomponent inEnhancedLoggingBanner.tsx.About.tsxto include enhanced logging toggle.ExtensionStateContext.tsxto manage enhanced logging state.enhancedLogging.spec.tsto cover logging functionality.settings.jsonfor enhanced logging descriptions and labels.This description was created by
for 27558b8. You can customize this summary. It will automatically update as commits are pushed.