Skip to content

Commit b2ccf2b

Browse files
committed
docs: add refactoring plan for proper logging implementation (#184)
1 parent c7601f3 commit b2ccf2b

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

refactoring-plan-184.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Refactoring Plan for Issue #184: Replace Debug Statements with Proper Logging
2+
3+
## Overview
4+
This PR replaces all DEBUG print statements with proper Python logging framework.
5+
6+
## Implementation Plan:
7+
8+
### 1. Create logging configuration module:
9+
```python
10+
# src/tsbootstrap/logging_config.py
11+
import logging
12+
import sys
13+
14+
def setup_logging(level=logging.INFO):
15+
"""Configure logging for tsbootstrap"""
16+
logger = logging.getLogger('tsbootstrap')
17+
logger.setLevel(level)
18+
19+
# Console handler
20+
handler = logging.StreamHandler(sys.stdout)
21+
formatter = logging.Formatter(
22+
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
23+
)
24+
handler.setFormatter(formatter)
25+
logger.addHandler(handler)
26+
27+
return logger
28+
```
29+
30+
### 2. Replace print statements:
31+
- Search for all `print("DEBUG:` statements
32+
- Replace with `logger.debug()`
33+
- Add logger initialization to each module
34+
35+
### 3. Add user control:
36+
```python
37+
# Allow users to control logging
38+
import tsbootstrap
39+
tsbootstrap.set_log_level(logging.DEBUG)
40+
```
41+
42+
## Files affected:
43+
- All Python files containing DEBUG statements
44+
- New file: `logging_config.py`
45+
46+
## Testing plan:
47+
- Verify no print statements remain
48+
- Test log output at different levels
49+
- Ensure logs don't appear in normal usage

0 commit comments

Comments
 (0)