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:
@ -10,6 +10,7 @@ from PySide6.QtWidgets import (
|
||||
from PySide6.QtCore import Qt, Signal, QThread
|
||||
from PySide6.QtGui import QFont
|
||||
from typing import List, Dict, Any, Optional
|
||||
import logging
|
||||
|
||||
from activitypub.client import ActivityPubClient
|
||||
from models.user import User
|
||||
@ -26,6 +27,7 @@ class FetchDetailsThread(QThread):
|
||||
super().__init__()
|
||||
self.client = client
|
||||
self.post_id = post_id
|
||||
self.logger = logging.getLogger('bifrost.post_details')
|
||||
|
||||
def run(self):
|
||||
"""Fetch favorites and boosts in background"""
|
||||
@ -40,14 +42,14 @@ class FetchDetailsThread(QThread):
|
||||
favourited_by_data = self.client.get_status_favourited_by(self.post_id)
|
||||
details['favourited_by'] = favourited_by_data
|
||||
except Exception as e:
|
||||
print(f"Failed to fetch favorites: {e}")
|
||||
self.logger.error(f"Failed to fetch favorites: {e}")
|
||||
|
||||
# Fetch who boosted this post
|
||||
try:
|
||||
reblogged_by_data = self.client.get_status_reblogged_by(self.post_id)
|
||||
details['reblogged_by'] = reblogged_by_data
|
||||
except Exception as e:
|
||||
print(f"Failed to fetch boosts: {e}")
|
||||
self.logger.error(f"Failed to fetch boosts: {e}")
|
||||
|
||||
self.details_loaded.emit(details)
|
||||
|
||||
@ -63,6 +65,7 @@ class PostDetailsDialog(QDialog):
|
||||
self.post = post
|
||||
self.client = client
|
||||
self.sound_manager = sound_manager
|
||||
self.logger = logging.getLogger('bifrost.post_details')
|
||||
|
||||
self.setWindowTitle("Post Details")
|
||||
self.setModal(True)
|
||||
@ -170,7 +173,7 @@ class PostDetailsDialog(QDialog):
|
||||
item.setData(Qt.UserRole, user)
|
||||
self.favorites_list.addItem(item)
|
||||
except Exception as e:
|
||||
print(f"Error parsing favorite user: {e}")
|
||||
self.logger.error(f"Error parsing favorite user: {e}")
|
||||
else:
|
||||
item = QListWidgetItem("No one has favorited this post yet")
|
||||
self.favorites_list.addItem(item)
|
||||
@ -188,7 +191,7 @@ class PostDetailsDialog(QDialog):
|
||||
item.setData(Qt.UserRole, user)
|
||||
self.boosts_list.addItem(item)
|
||||
except Exception as e:
|
||||
print(f"Error parsing boost user: {e}")
|
||||
self.logger.error(f"Error parsing boost user: {e}")
|
||||
else:
|
||||
item = QListWidgetItem("No one has boosted this post yet")
|
||||
self.boosts_list.addItem(item)
|
||||
|
Reference in New Issue
Block a user