Logging improvements

This commit is contained in:
Ian Renton
2026-07-26 07:51:25 +01:00
parent c3bcc1190d
commit 77d7fd70d9
17 changed files with 48 additions and 48 deletions
+9 -9
View File
@@ -11,7 +11,7 @@ from pyhamtools import LookupLib, Callinfo, callinfo
from pyhamtools.exceptions import APIKeyMissingError
from pyhamtools.frequency import freq_to_band
from pyhamtools.locator import latlong_to_locator
from requests.exceptions import ConnectionError, ReadTimeout
from requests.exceptions import ConnectionError, ReadTimeout, ConnectTimeout
from requests_cache import CachedSession
from core.cache_utils import SEMI_STATIC_URL_DATA_CACHE
@@ -156,8 +156,8 @@ class LookupHelper:
except ConnectionError:
logging.warning(f"Connection error when downloading Clublog cty.xml.")
except ReadTimeout:
logging.warning(f"Read timeout when downloading Clublog cty.xml.")
except (ConnectTimeout, ReadTimeout):
logging.warning(f"Timeout when downloading Clublog cty.xml.")
except Exception as e:
logging.error("Exception when downloading Clublog cty.xml", e)
return False
@@ -182,8 +182,8 @@ class LookupHelper:
except ConnectionError:
logging.warning(f"Connection error when downloading dxcc.json.")
except ReadTimeout:
logging.warning(f"Read timeout when downloading dxcc.json.")
except (ConnectTimeout, ReadTimeout):
logging.warning(f"Timeout when downloading dxcc.json.")
except Exception as e:
logging.error("Exception when downloading dxcc.json", e)
return False
@@ -541,8 +541,8 @@ class LookupHelper:
except ConnectionError:
logging.warning(f"Connection error when looking up callsign %s using QRZ", lookup_call)
continue
except ReadTimeout:
logging.warning(f"Read timeout when looking up callsign %s using QRZ.", lookup_call)
except (ConnectTimeout, ReadTimeout):
logging.warning(f"Timeout when looking up callsign %s using QRZ.", lookup_call)
continue
except Exception:
logging.error("Exception when looking up callsign %s using QRZ", lookup_call, exc_info=True)
@@ -608,8 +608,8 @@ class LookupHelper:
except ConnectionError:
logging.warning(f"Connection error when looking up callsign %s using HamQTH", lookup_call)
continue
except ReadTimeout:
logging.warning(f"Read timeout when looking up callsign %s using HamQTH", lookup_call)
except (ConnectTimeout, ReadTimeout):
logging.warning(f"Timeout when looking up callsign %s using HamQTH", lookup_call)
continue
except Exception:
logging.error("Exception when looking up callsign %s using HamQTH", lookup_call, exc_info=True)
+3 -3
View File
@@ -2,7 +2,7 @@ import csv
import logging
from pyhamtools.locator import latlong_to_locator, locator_to_latlong
from requests.exceptions import ConnectionError, ReadTimeout
from requests.exceptions import ConnectionError, ReadTimeout, ConnectTimeout
from core.cache_utils import SEMI_STATIC_URL_DATA_CACHE
from core.constants import SIGS, HTTP_HEADERS
@@ -271,8 +271,8 @@ def populate_sig_ref_info(sig_ref):
except ConnectionError:
logging.warning("Connection error when looking up sig_ref info for " + sig + " ref " + ref_id)
except ReadTimeout:
logging.warning(f"Read timeout when looking up sig_ref info for " + sig + " ref " + ref_id)
except (ConnectTimeout, ReadTimeout):
logging.warning(f"Timeout when looking up sig_ref info for " + sig + " ref " + ref_id)
except Exception:
logging.error("Exception when looking up sig_ref info for " + sig + " ref " + ref_id, exc_info=True)
return sig_ref