CRITICAL FIX: Robust DB connection + drops attribute + no duplicate logging
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled

This commit is contained in:
2025-12-17 12:03:40 +01:00
parent 52770986cd
commit e8d23e8a49

View File

@ -63,21 +63,22 @@ SWITCH_CONFIG = {
}
# Setup logging (avoid duplicate handlers)
logger = logging.getLogger("zone_sync")
if not logger.handlers:
logger.setLevel(logging.INFO)
logger = logging.getLogger("pounce_zone_sync")
logger.setLevel(logging.INFO)
if not logger.handlers: # Only add handlers once
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
# Console handler
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
# File handler (if directory exists)
if LOG_FILE.parent.exists():
console = logging.StreamHandler()
console.setFormatter(formatter)
logger.addHandler(console)
# File handler
try:
LOG_FILE.parent.mkdir(parents=True, exist_ok=True)
file_handler = logging.FileHandler(LOG_FILE)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
except Exception:
pass # File logging optional
class ZoneSyncResult: