diff --git a/app/utils/countrycodes.py b/app/utils/countrycodes.py index c8eb8249..f3e90e8f 100644 --- a/app/utils/countrycodes.py +++ b/app/utils/countrycodes.py @@ -1,5 +1,8 @@ +import logging from itertools import chain +LOGGER = logging.getLogger(__name__) + # Default country code. default_code = "XX" @@ -374,4 +377,11 @@ def country_code(country): country = synonyms[country] # Get country or fallback to default_code. - return is_3166_1.get(country, default_code) + country_code = is_3166_1.get(country, default_code) + + # Default picked? + if country_code == default_code: + LOGGER.warning(f"No country_code found for '{country}'. Using '{country_code}'!") + + # Return. + return country_code diff --git a/app/utils/populations.py b/app/utils/populations.py index 60ceff3d..8a78ec50 100644 --- a/app/utils/populations.py +++ b/app/utils/populations.py @@ -1,3 +1,4 @@ +import logging from io import BytesIO, StringIO from zipfile import ZipFile, ZipInfo @@ -6,6 +7,7 @@ from .countrycodes import country_code +LOGGER = logging.getLogger(__name__) # Fetching of the populations. def fetch_populations(): @@ -15,7 +17,7 @@ def fetch_populations(): :returns: The mapping of populations. :rtype: dict """ - print("Fetching populations...") + LOGGER.info("Fetching populations...") # Mapping of populations mappings = {}