From df0da67aa757f464e91bf4f5dce960a31da3d8f5 Mon Sep 17 00:00:00 2001 From: Sankalp Gilda Date: Sat, 28 Jun 2025 19:38:47 -0400 Subject: [PATCH] docs: add refactoring plan for proper logging implementation (#184) --- refactoring-plan-184.md | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 refactoring-plan-184.md diff --git a/refactoring-plan-184.md b/refactoring-plan-184.md new file mode 100644 index 00000000..2dba66e7 --- /dev/null +++ b/refactoring-plan-184.md @@ -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 \ No newline at end of file