You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+38-7Lines changed: 38 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,18 +38,49 @@ The entire extension's logic is contained within the `CopilotTokenTracker` class
38
38
39
39
## Logging Best Practices
40
40
41
-
**CRITICAL**: Do NOT add debug logging statements like `log('[DEBUG] message')` for troubleshooting during development. This approach has been found to interfere with the output channel and can hide existing log messages from appearing.
41
+
**CRITICAL**: Do NOT add debug logging statements like `this.log('[DEBUG] message')`or `console.log('[DEBUG] ...')`for troubleshooting during development. This approach has been found to flood the output channel and cause messages to disappear.
42
42
43
-
-**Use Existing Logs**: The extension already has comprehensive logging throughout. Review existing log statements to understand what's being tracked.
44
-
-**Minimal Logging**: Only add logging if absolutely necessary for a new feature. Keep messages concise and informative.
45
-
-**Remove Debug Logs**: Any temporary debug logging added during development MUST be removed before committing code.
46
-
-**Log Methods**: Use the appropriate method for the severity:
43
+
### Why DEBUG Logs Are Problematic
44
+
45
+
**Extension Host Flooding**: When DEBUG log statements are added to frequently-called methods in `extension.ts` (e.g., cache lookups, file processing loops, webview message handlers), they can generate hundreds of log entries per operation. VS Code's OutputChannel has a buffer limit, and excessive logging causes older messages to be pushed out and lost. This was observed when:
46
+
- Cache hit/miss logging was added to session file processing
47
+
- JSONL content reference counting was logged for each file
48
+
- Webview message handlers logged every incoming message with full JSON payloads
49
+
- Session data was logged with repository counts on each webview update
50
+
51
+
**Symptom**: After operations like clearing the cache, expected log messages would disappear from the Output panel because they were pushed out of the buffer by DEBUG logs.
52
+
53
+
### Extension vs Webview Logging
54
+
55
+
These are two completely separate logging systems:
0 commit comments