Commit 36f1b9c
committed
feat: comprehensive debug logging system with capture and download
Add a robust debug logging system that captures application state, user interactions, and system diagnostics for enhanced troubleshooting and development experience.
## ✨ Features Added
### 🔍 **Multi-Source Data Capture**
- **Console Logging**: Captures all console.log, console.warn, console.error
- **Error Handling**: Intercepts JavaScript errors and unhandled promise rejections
- **Network Monitoring**: Tracks all fetch requests with timing and status
- **User Actions**: Records user interactions and UI events
- **Terminal Activity**: Captures shell input/output with ANSI cleaning
- **Performance Metrics**: Memory usage, page load times, paint timing
### 📊 **System Information Collection**
- Platform detection (macOS, Windows, Linux)
- Browser and viewport information
- Git repository status (branch, commit, dirty state)
- Application state (model, provider, workbench view)
- Performance and memory statistics
### 🎯 **User Interface Integration**
- **Avatar Dropdown**: "Download Debug Log" option with download icon
- **Header Actions**: "Debug Log" button alongside existing "Report Bug"
- **One-Click Download**: Generates comprehensive debug reports
- **Error Handling**: Graceful degradation with user feedback
### 🔧 **Technical Implementation**
- **Circular Buffers**: Memory-efficient storage with fixed capacity (1K entries)
- **Lazy Loading**: Zero performance impact when disabled (default state)
- **Debouncing**: Terminal logs debounced at 100ms to prevent spam
- **JSON Safe**: Circular reference protection and depth limiting
- **Async Operations**: Non-blocking debug operations
### 📁 **Files Modified**
- `app/utils/debugLogger.ts` (1,284 lines) - Core debug logging utility
- `app/utils/logger.ts` - Integration with existing logging system
- `app/utils/shell.ts` - Terminal activity capture
- `app/components/@settings/core/AvatarDropdown.tsx` - UI integration
- `app/components/header/HeaderActionButtons.client.tsx` - Header button
- `app/root.tsx` - Initialization and setup
- `app/routes/api.git-info.ts` - Git information endpoint
## 🚀 **Benefits**
- **Enhanced Debugging**: Comprehensive data collection for issue reproduction
- **Performance Monitoring**: Built-in performance tracking and memory analysis
- **User Support**: Easy debug log generation for support tickets
- **Developer Experience**: Rich debugging data without performance penalty
- **Production Ready**: Opt-in system with zero impact on regular users
## 🔒 **Security & Privacy**
- Client-side only operation (no server transmission)
- User-controlled data collection and export
- No sensitive information captured automatically
- Manual opt-in required for debug mode activation
## 📈 **Performance Impact**
- **Disabled by Default**: No performance impact for regular users
- **Lazy Initialization**: Components loaded only when needed
- **Memory Bounded**: Fixed-size buffers prevent memory leaks
- **Non-Blocking**: All operations are asynchronous
- **Efficient Storage**: Circular buffers with automatic cleanup
## 🔄 **Integration Points**
- Seamlessly integrates with existing `logger` utility
- Compatible with current shell/terminal implementation
- Works with existing error handling patterns
- Maintains backward compatibility
This implementation provides developers and users with powerful debugging capabilities while maintaining excellent performance and user experience.1 parent a44de8a commit 36f1b9c
File tree
7 files changed
+1495
-12
lines changed- app
- components
- @settings/core
- header
- routes
- utils
7 files changed
+1495
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
133 | 156 | | |
134 | 157 | | |
135 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
35 | 51 | | |
36 | 52 | | |
37 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
96 | 114 | | |
97 | 115 | | |
98 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments