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
+10 -8
View File
@@ -17,6 +17,8 @@ from providers.callsigndata.api_query_callsign_data_provider import (
APIQueryCallsignDataProvider,
)
logger = logging.getLogger(__name__)
class HamQTH(APIQueryCallsignDataProvider):
"""Callsign data provider for HamQTH."""
@@ -55,10 +57,10 @@ class HamQTH(APIQueryCallsignDataProvider):
session_id = str(dict_data["HamQTH"]["session"]["session_id"])
else:
# Log this failure at debug level only, not our problem if user entered the wrong password.
logging.debug("HamQTH login details incorrect, failed to look up with HamQTH.")
logger.debug("HamQTH login details incorrect, failed to look up with HamQTH.")
return None
except Exception:
logging.error("Exception when getting HamQTH session key")
logger.error("Exception when getting HamQTH session key")
return None
if not session_id:
@@ -71,7 +73,7 @@ class HamQTH(APIQueryCallsignDataProvider):
if home_call != callsign:
calls_to_try.append(home_call)
except ValueError:
logging.debug(f"Could not look up home call for callsign {callsign}")
logger.debug(f"Could not look up home call for callsign {callsign}")
# Try looking up each call using the API
for lookup_call in calls_to_try:
@@ -90,18 +92,18 @@ class HamQTH(APIQueryCallsignDataProvider):
return self.hamqth_response_to_callsign(callsign, data)
elif not response.from_cache:
logging.warning(f"HTTP {response.status_code} looking up callsign {lookup_call} using HamQTH")
logger.warning(f"HTTP {response.status_code} looking up callsign {lookup_call} using HamQTH")
except (KeyError, ValueError):
continue
except ConnectionError:
logging.warning(f"Connection error when looking up callsign {lookup_call} using HamQTH")
logger.warning(f"Connection error when looking up callsign {lookup_call} using HamQTH")
continue
except (ConnectTimeout, ReadTimeout):
logging.warning(f"Timeout when looking up callsign {lookup_call} using HamQTH")
logger.warning(f"Timeout when looking up callsign {lookup_call} using HamQTH")
continue
except Exception:
logging.exception(f"Exception when looking up callsign {lookup_call} using HamQTH")
logger.exception(f"Exception when looking up callsign {lookup_call} using HamQTH")
continue
# Not found in HamQTH; return a Callsign object with no data so we cache that and don't keep retrying
@@ -109,7 +111,7 @@ class HamQTH(APIQueryCallsignDataProvider):
except Exception:
self.status = "Error"
logging.exception("Exception when looking up data from HamQTH")
logger.exception("Exception when looking up data from HamQTH")
# Return None, this won't be cached so we will be asked to query data again for this call next time.
return None