Replace root logger calls with module-specific loggers

This commit is contained in:
Ian Renton
2026-08-15 08:35:06 +01:00
parent 74bcd9cded
commit dd89ff4af7
64 changed files with 328 additions and 216 deletions
+5 -3
View File
@@ -5,6 +5,8 @@ import time
import diskcache
from cachetools import TTLCache
logger = logging.getLogger(__name__)
class LiveDataCache:
"""Cache for spots and alerts. Uses the fast in-memory TTLCache for normal data I/O, including the TTL to enforce
@@ -34,7 +36,7 @@ class LiveDataCache:
try:
callback(value)
except Exception:
logging.exception(f"Listener raised an exception for key {key}")
logger.exception(f"Listener raised an exception for key {key}")
def get(self, key, default=None):
with self._lock:
@@ -70,7 +72,7 @@ class LiveDataCache:
try:
self._disk_cache.set("snapshot", data)
except Exception as e:
logging.exception(f"Failed to write snapshot to {self._snapshot_dir}")
logger.exception(f"Failed to write snapshot to {self._snapshot_dir}")
def _load_snapshot(self):
data = self._disk_cache.get("snapshot")
@@ -83,7 +85,7 @@ class LiveDataCache:
# Only restore entries that would still be within TTL
if now - saved_at < self._ttl:
self._cache[key] = value
logging.info(f"Loaded snapshot from {self._snapshot_dir}")
logger.info(f"Loaded snapshot from {self._snapshot_dir}")
def _start_periodic_snapshot(self, interval):
def loop():