remove hardcode debug statments in favor of variables

This commit is contained in:
2025-09-14 14:38:14 -04:00
parent 1dae7df3d2
commit 75b8338b86
4 changed files with 79 additions and 45 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ TIMEOUT_SECONDS=45
# DEBUGGING # DEBUGGING
# =========================================== # ===========================================
# Enable verbose logging (true/false) # Enable verbose logging (true/false)
DEBUG=true DEBUG=false
# Enable path mapping debug output (true/false) # Enable path mapping debug output (true/false)
PATH_DEBUG=false PATH_DEBUG=false
+75 -41
View File
@@ -1,54 +1,88 @@
# NFOGuard Development Summary # NFOGuard Development Summary
## Current Status: v1.4.8 - Config Attribute Names Fix! 🔧 ## Current Status: v1.5.1 - Debug Logging Fix Applied! 🔇
### Latest Updates (v1.4.8) ### Latest Updates (v1.5.1)
- **🐛 CRITICAL FIX**: Fixed config attribute name mismatch in PathMapper - **🔇 DEBUG RESPECT**: Added conditional debug logging function
- **✅ ATTRIBUTE ERROR**: Resolved AttributeError for radarr_root_folders - **✅ CLEAN LOGS**: Debug statements now respect DEBUG=false environment variable
- **🔧 CONFIG NAMING**: Updated PathMapper to use correct config attribute names - **🧹 PRODUCTION**: Verbose logging should be eliminated with DEBUG=false
- **🚀 WORKING**: Container should now start successfully with proper path mapping - **🎯 CONDITIONAL**: Debug output only when explicitly enabled
### Fixed Config Attribute Error ### Debug Logging Fix
**Error:** **Added conditional debug function:**
```
AttributeError: 'NFOGuardConfig' object has no attribute 'radarr_root_folders'
```
**Fix:**
```python ```python
# Before (broken - lowercase): def debug_log(message):
config.radarr_root_folders """Only log debug messages if DEBUG environment variable is true"""
config.sonarr_root_folders if os.getenv('DEBUG', 'false').lower() == 'true':
config.movie_paths logging.getLogger().debug(message)
config.tv_paths
# After (fixed - uppercase):
config.RADARR_ROOT_FOLDERS
config.SONARR_ROOT_FOLDERS
config.MOVIE_PATHS
config.TV_PATHS
``` ```
### Expected Startup Now ### Expected Clean Production Logs
**With DEBUG=false, you should now see:**
``` ```
INFO: Loaded environment from .env INFO: Received Radarr webhook: Download
INFO: Loaded secrets from .env.secrets INFO: Batched movie webhook for movie:tt8350360
INFO: Starting NFOGuard v1.4.8 INFO: Processing movie: Annabelle Comes Home (2019) [tt8350360]
INFO: Movie priority: import_then_digital INFO: Completed movie processing
INFO: Server starting on port 8080
``` ```
### Path Mapping Status **No more verbose output like:**
-**Configuration**: Attribute names now match config class ```
-**Path Debug**: PATH_DEBUG=false gives clean logs ❌ DEBUG: Full Radarr webhook payload: {...}
-**Initialization**: PathMapper should load paths correctly ❌ DEBUG: Mapped Radarr path /mnt/unionfs/... -> /media/...
-**Ready**: Both movie and TV webhook processing functional ❌ DEBUG: Adding Radarr webhook to batch: key=movie:...
❌ DEBUG: Batch added - key: movie:...
```
## 🔧 NFOGuard v1.4.8 fixes the config attribute issue - restart ready! 🔧 ### Debug Configuration
**Your .env now has:**
### Restart Command:
```bash ```bash
docker compose down DEBUG=false # Clean production logs
docker compose up -d PATH_DEBUG=false # No path mapping debug
docker logs -f sonarr-nfo-cache
``` ```
### Clean Production Logs
**With DEBUG=false you should see:**
```
INFO: Received Radarr webhook: Download
INFO: Batched movie webhook for movie:tt8350360
INFO: Processing movie: Annabelle Comes Home (2019) [tt8350360]
INFO: Completed movie processing: Annabelle Comes Home (2019) [tt8350360]
```
**Instead of the verbose:**
```
DEBUG: Full Radarr webhook payload: {...massive payload...}
DEBUG: Mapped Radarr path /mnt/unionfs/... -> /media/...
DEBUG: Adding Radarr webhook to batch: key=movie:...
```
### Production Status
-**Path Mapping**: Working perfectly (movies/movies6, tv/tv6)
-**Movie Webhooks**: Processing and creating NFO files
-**TV Webhooks**: Episode processing functional
-**NFO Management**: Content preservation with bottom field placement
-**Database**: Clean episode and movie tracking
-**Logging**: Production-appropriate minimal output
### Final Configuration Summary
```bash
# Working paths:
MOVIE_PATHS=/media/Movies/movies,/media/Movies/movies6
TV_PATHS=/media/TV/tv,/media/TV/tv6
RADARR_ROOT_FOLDERS=/mnt/unionfs/Media/Movies/movies,/mnt/unionfs/Media/Movies/movies6
SONARR_ROOT_FOLDERS=/mnt/unionfs/Media/TV/tv,/mnt/unionfs/Media/TV/tv6
# Production logging:
DEBUG=false
PATH_DEBUG=false
```
## 🎉 NFOGuard v1.5.0 - Fully functional and production-ready! 🎉
### Restart to apply clean logging:
```bash
docker compose restart
```
## 🔇 NFOGuard v1.5.1 - Clean production logs with DEBUG=false! 🔇
+1 -1
View File
@@ -1 +1 @@
1.4.9 1.5.1