Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions refactoring-plan-184.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Refactoring Plan for Issue #184: Replace Debug Statements with Proper Logging

## Overview
This PR replaces all DEBUG print statements with proper Python logging framework.

## Implementation Plan:

### 1. Create logging configuration module:
```python
# src/tsbootstrap/logging_config.py
import logging
import sys

def setup_logging(level=logging.INFO):
"""Configure logging for tsbootstrap"""
logger = logging.getLogger('tsbootstrap')
logger.setLevel(level)

# Console handler
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
handler.setFormatter(formatter)
logger.addHandler(handler)

return logger
```

### 2. Replace print statements:
- Search for all `print("DEBUG:` statements
- Replace with `logger.debug()`
- Add logger initialization to each module

### 3. Add user control:
```python
# Allow users to control logging
import tsbootstrap
tsbootstrap.set_log_level(logging.DEBUG)
```

## Files affected:
- All Python files containing DEBUG statements
- New file: `logging_config.py`

## Testing plan:
- Verify no print statements remain
- Test log output at different levels
- Ensure logs don't appear in normal usage