Skip to content

📝 Replace print statements with proper logging #28

Description

@ZeroSumQuant

Code Quality Improvement

Issue

Currently using print statements for error handling and debugging. Should use Python's logging module for professional error handling.

Current Problems

  • No log levels (INFO, WARNING, ERROR)
  • No ability to disable/filter logs
  • No timestamps in logs
  • Hard to debug issues in production

Proposed Implementation

import logging

# Configure at module level
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)

class ClaudeConversationExtractor:
    def __init__(self, output_dir: Optional[Path] = None, verbose: bool = False):
        self.logger = logger
        self.verbose = verbose
        # ... rest of init ...
    
    def extract_conversation(self, jsonl_path: Path) -> List[Dict[str, str]]:
        try:
            # ... processing ...
        except json.JSONDecodeError as e:
            self.logger.warning(f"Invalid JSON in {jsonl_path}: {e}")
        except IOError as e:
            self.logger.error(f"Cannot read {jsonl_path}: {e}")
            raise  # Re-raise for caller to handle

Files to Update

  • extract_claude_logs.py
  • search_conversations.py
  • realtime_search.py
  • interactive_ui.py

Benefits

  • Professional error handling
  • Configurable log levels
  • Better debugging capabilities
  • Log file support for troubleshooting
  • Cleaner console output

Priority

LOW - Code quality improvement

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions