feat: implement timezone-aware logging system
- Fix inconsistent timestamp formats in logs for easier troubleshooting - All logging systems now respect Docker TZ environment variable (e.g., TZ=America/New_York) - Add TimezoneAwareFormatter for Python's standard logging module - Enhance _log function with robust timezone support and fallbacks - Replace placeholder logging functions with centralized core.logging._log - Support both zoneinfo (Python 3.9+) and pytz (older versions) - Users now see consistent timezone formatting across all log outputs
This commit is contained in:
+41
-2
@@ -210,6 +210,45 @@ Preserve movie and TV import dates in Emby/Jellyfin/Plex by preventing upgraded
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** September 13, 2025
|
||||
**Version:** v0.6.3-dev
|
||||
### 🆕 v0.6.4 Timezone-Aware Logging Fix (September 2025)
|
||||
|
||||
**🕰️ Universal Timezone Consistency:**
|
||||
- **Problem**: Mixed timestamp formats in logs made troubleshooting difficult
|
||||
- Some logs: `[2025-09-14T09:37:00.338045]` (local time without timezone info)
|
||||
- Other logs: `[2025-09-14T13:37:00+00:00]` (UTC with timezone info)
|
||||
- Docker `TZ=America/New_York` environment variable not respected by all logging systems
|
||||
|
||||
**⚡ Comprehensive Logging Fix:**
|
||||
- **Unified Timezone Handling**: All logging systems now respect the `TZ` environment variable
|
||||
- **Custom TimezoneAwareFormatter**: Python's standard logging now uses container timezone
|
||||
- **Enhanced _log Function**: Custom logging function updated with robust timezone support
|
||||
- **Centralized Logging**: Replaced placeholder logging functions with consistent implementation
|
||||
|
||||
**🔧 Technical Implementation:**
|
||||
- **New Class**: `TimezoneAwareFormatter` for Python's standard logging module
|
||||
- **Enhanced Function**: `_get_local_timezone()` with fallbacks for different Python versions
|
||||
- **Cross-Compatibility**: Supports both `zoneinfo` (Python 3.9+) and `pytz` (older versions)
|
||||
- **Consistent Import**: All client modules now use centralized `core.logging._log`
|
||||
|
||||
**🏆 User Experience Improvements:**
|
||||
- **Consistent Timestamps**: All logs now show the same timezone format
|
||||
- **Easier Troubleshooting**: Timestamps match user's local environment
|
||||
- **No More Confusion**: No need to mentally convert between UTC and local time
|
||||
- **Production Ready**: Robust fallbacks ensure logging works in all environments
|
||||
|
||||
**📋 Before/After Example:**
|
||||
```
|
||||
# Before (Inconsistent)
|
||||
sonarr-nfo-cache | [2025-09-14T09:37:00.338045] DEBUG: Mapped Radarr path...
|
||||
sonarr-nfo-cache | [2025-09-14T13:37:00+00:00] INFO: Batched movie webhook...
|
||||
|
||||
# After (Consistent)
|
||||
sonarr-nfo-cache | [2025-09-14T09:37:00-04:00] DEBUG: Mapped Radarr path...
|
||||
sonarr-nfo-cache | [2025-09-14T09:37:00-04:00] INFO: Batched movie webhook...
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** September 14, 2025
|
||||
**Version:** v0.6.4-dev
|
||||
**Status:** Enhanced Production Ready
|
||||
Reference in New Issue
Block a user