Implement comprehensive professional logging system
Added complete logging infrastructure for AI-only development debugging: **Core Logging Features:** - Command-line debug flags: -d (console) and -d filename (file output) - Custom log format: "message - severity - timestamp" - Professional Python logging with hierarchical loggers (bifrost.module) - Clean separation: debug mode vs production (warnings/errors only) **Comprehensive Coverage - Replaced 55+ Print Statements:** - timeline_view.py: Timeline operations, new content detection, sound events - main_window.py: Auto-refresh system, streaming mode, UI events - activitypub/client.py: API calls, streaming connections, server detection - audio/sound_manager.py: Sound playback, pack loading, volume control - error_manager.py: Centralized error handling with proper log levels - All remaining modules: Complete print statement elimination **Enhanced Auto-Refresh Debugging:** - Fixed repetitive refresh interval logging (only logs on changes) - Added detailed auto-refresh execution tracing with timing - New content detection logging with post ID tracking - Sound event logging showing which sounds play and why **Sound System Visibility:** - Complete audio event logging with file paths and volumes - Sound pack loading and fallback detection - Audio playback success/failure with detailed error context **Documentation Updates:** - README.md: Complete debug system documentation for users - CLAUDE.md: Professional logging guidelines for AI development - Comprehensive usage examples and troubleshooting guides This logging system provides essential debugging capabilities for the AI-only development constraint, enabling systematic issue resolution without human code intervention. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
110
README.md
110
README.md
@ -134,6 +134,116 @@ sudo pacman -S python-pyside6 python-requests python-simpleaudio python-emoji
|
||||
yay -S python-plyer
|
||||
```
|
||||
|
||||
## Debug Logging System
|
||||
|
||||
Bifrost includes a comprehensive logging system for debugging and troubleshooting. This is especially valuable since the project is developed entirely by AI and requires excellent diagnostic capabilities.
|
||||
|
||||
### Debug Modes
|
||||
|
||||
**Console Debugging:**
|
||||
```bash
|
||||
python bifrost.py -d
|
||||
```
|
||||
Shows debug output in the terminal with real-time logging.
|
||||
|
||||
**File Debugging:**
|
||||
```bash
|
||||
python bifrost.py -d debug.log
|
||||
```
|
||||
Saves all debug output to the specified file for later analysis.
|
||||
|
||||
**Production Mode (Default):**
|
||||
```bash
|
||||
python bifrost.py
|
||||
```
|
||||
Only shows warnings and errors to stderr.
|
||||
|
||||
### Log Format
|
||||
|
||||
All log entries use the format: `message - severity - timestamp`
|
||||
|
||||
Example:
|
||||
```
|
||||
Timeline refresh requested: auto_refresh - DEBUG - 2025-07-22 23:17:33
|
||||
New content detected: newest post changed from abc123 to def456 - INFO - 2025-07-22 23:17:34
|
||||
Playing timeline_update sound for home timeline - INFO - 2025-07-22 23:17:34
|
||||
Playing sound: timeline_update from /path/to/sound.wav at volume 100 - INFO - 2025-07-22 23:17:34
|
||||
```
|
||||
|
||||
### What Gets Logged
|
||||
|
||||
**Application Lifecycle:**
|
||||
- Startup and shutdown events
|
||||
- Window creation and display
|
||||
- Settings initialization
|
||||
- Account management operations
|
||||
|
||||
**Timeline Operations:**
|
||||
- Auto-refresh timing and triggers
|
||||
- New content detection
|
||||
- Timeline switching
|
||||
- Thread expansion/collapse
|
||||
|
||||
**Sound System:**
|
||||
- Which sounds are played and when
|
||||
- Sound pack loading and switching
|
||||
- Audio playback success/failure
|
||||
- Volume and file path information
|
||||
|
||||
**Network Activity:**
|
||||
- ActivityPub API requests
|
||||
- Streaming connection attempts
|
||||
- Server capability detection
|
||||
- Authentication operations
|
||||
|
||||
**User Interactions:**
|
||||
- Post composition and sending
|
||||
- Reply, boost, and favorite actions
|
||||
- Menu and keyboard shortcut usage
|
||||
- Timeline navigation
|
||||
|
||||
**Error Handling:**
|
||||
- Network failures and timeouts
|
||||
- API errors and invalid responses
|
||||
- Audio playback issues
|
||||
- File system problems
|
||||
|
||||
### Debug Use Cases
|
||||
|
||||
**Auto-refresh Issues:**
|
||||
```bash
|
||||
python bifrost.py -d | grep -i refresh
|
||||
```
|
||||
See exactly when refreshes are triggered and why they might fail.
|
||||
|
||||
**Sound Problems:**
|
||||
```bash
|
||||
python bifrost.py -d | grep -i "sound\|audio"
|
||||
```
|
||||
Track which sounds are played and identify audio system issues.
|
||||
|
||||
**Network Debugging:**
|
||||
```bash
|
||||
python bifrost.py -d debug.log
|
||||
# Then examine debug.log for ActivityPub and streaming logs
|
||||
```
|
||||
|
||||
**New Content Detection:**
|
||||
```bash
|
||||
python bifrost.py -d | grep -i "new content"
|
||||
```
|
||||
See when new posts are detected and why sounds might not play.
|
||||
|
||||
### Log Levels
|
||||
|
||||
- **DEBUG**: Detailed execution flow (timing, state changes, method calls)
|
||||
- **INFO**: Important events (new content, sounds played, operations completed)
|
||||
- **WARNING**: Recoverable issues (fallback operations, missing optional features)
|
||||
- **ERROR**: Serious problems (network failures, invalid data, system errors)
|
||||
- **CRITICAL**: Fatal issues that prevent operation
|
||||
|
||||
This logging system enables effective troubleshooting of any issues that arise during development or use.
|
||||
|
||||
## Poll Features
|
||||
|
||||
Bifrost includes comprehensive poll support with full accessibility:
|
||||
|
Reference in New Issue
Block a user