Skip to content

Commit

Permalink
fix: remove module from logging and shorten loggers names (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Oct 16, 2023
1 parent e98e0a9 commit 93e61ca
Show file tree
Hide file tree
Showing 28 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion eodag/api/product/_product.py
Expand Up @@ -44,7 +44,7 @@
from shapely.errors import TopologicalError as GEOSException


logger = logging.getLogger("eodag.api.product")
logger = logging.getLogger("eodag.product")


class EOProduct:
Expand Down
2 changes: 1 addition & 1 deletion eodag/api/product/metadata_mapping.py
Expand Up @@ -46,7 +46,7 @@
update_nested_dict,
)

logger = logging.getLogger("eodag.api.product.metadata_mapping")
logger = logging.getLogger("eodag.product.metadata_mapping")

SEP = r"#"
INGEST_CONVERSION_REGEX = re.compile(
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/apis/base.py
Expand Up @@ -20,7 +20,7 @@
from eodag.plugins.base import PluginTopic
from eodag.plugins.download.base import DEFAULT_DOWNLOAD_TIMEOUT, DEFAULT_DOWNLOAD_WAIT

logger = logging.getLogger("eodag.plugins.apis.base")
logger = logging.getLogger("eodag.apis.base")


class Api(PluginTopic):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/apis/cds.py
Expand Up @@ -35,7 +35,7 @@
from eodag.utils.exceptions import AuthenticationError, DownloadError, RequestError
from eodag.utils.logging import get_logging_verbose

logger = logging.getLogger("eodag.plugins.apis.cds")
logger = logging.getLogger("eodag.apis.cds")

CDS_KNOWN_FORMATS = {"grib": "grib", "netcdf": "nc"}

Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/apis/ecmwf.py
Expand Up @@ -35,7 +35,7 @@
from eodag.utils.exceptions import AuthenticationError, DownloadError
from eodag.utils.logging import get_logging_verbose

logger = logging.getLogger("eodag.plugins.apis.ecmwf")
logger = logging.getLogger("eodag.apis.ecmwf")

ECMWF_MARS_KNOWN_FORMATS = {"grib": "grib", "netcdf": "nc"}

Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/apis/usgs.py
Expand Up @@ -51,7 +51,7 @@
RequestError,
)

logger = logging.getLogger("eodag.plugins.apis.usgs")
logger = logging.getLogger("eodag.apis.usgs")


class UsgsApi(Download, Api):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/authentication/keycloak.py
Expand Up @@ -25,7 +25,7 @@
from eodag.utils import HTTP_REQ_TIMEOUT, USER_AGENT
from eodag.utils.exceptions import AuthenticationError, MisconfiguredError

logger = logging.getLogger("eodag.plugins.auth.keycloak")
logger = logging.getLogger("eodag.auth.keycloak")


class KeycloakOIDCPasswordAuth(Authentication):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/authentication/sas_auth.py
Expand Up @@ -25,7 +25,7 @@
from eodag.utils import HTTP_REQ_TIMEOUT, USER_AGENT, deepcopy, format_dict_items
from eodag.utils.exceptions import AuthenticationError

logger = logging.getLogger("eodag.plugins.auth.sas_auth")
logger = logging.getLogger("eodag.auth.sas_auth")


class RequestsSASAuth(AuthBase):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/crunch/filter_date.py
Expand Up @@ -25,7 +25,7 @@

from eodag.plugins.crunch.base import Crunch

logger = logging.getLogger("eodag.plugins.crunch.filter_date")
logger = logging.getLogger("eodag.crunch.date")


class FilterDate(Crunch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/crunch/filter_latest_intersect.py
Expand Up @@ -25,7 +25,7 @@

from eodag.plugins.crunch.base import Crunch

logger = logging.getLogger("eodag.plugins.crunch.filter_latest_intersect")
logger = logging.getLogger("eodag.crunch.latest_intersect")


class FilterLatestIntersect(Crunch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/crunch/filter_latest_tpl_name.py
Expand Up @@ -22,7 +22,7 @@
from eodag.plugins.crunch.base import Crunch
from eodag.utils.exceptions import ValidationError

logger = logging.getLogger("eodag.plugins.crunch.filter_latest_tpl_name")
logger = logging.getLogger("eodag.crunch.latest_tpl_name")


class FilterLatestByName(Crunch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/crunch/filter_overlap.py
Expand Up @@ -28,7 +28,7 @@
from shapely.errors import TopologicalError as GEOSException


logger = logging.getLogger("eodag.plugins.crunch.filter_overlap")
logger = logging.getLogger("eodag.crunch.overlap")


class FilterOverlap(Crunch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/crunch/filter_property.py
Expand Up @@ -21,7 +21,7 @@

from eodag.plugins.crunch.base import Crunch

logger = logging.getLogger("eodag.plugins.crunch.filter_property")
logger = logging.getLogger("eodag.crunch.property")


class FilterProperty(Crunch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/download/aws.py
Expand Up @@ -44,7 +44,7 @@
)
from eodag.utils.exceptions import AuthenticationError, DownloadError, NotAvailableError

logger = logging.getLogger("eodag.plugins.download.aws")
logger = logging.getLogger("eodag.download.aws")

# AWS chunk path identify patterns

Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/download/base.py
Expand Up @@ -35,7 +35,7 @@
)
from eodag.utils.notebook import NotebookWidgets

logger = logging.getLogger("eodag.plugins.download.base")
logger = logging.getLogger("eodag.download.base")

# default wait times in minutes
DEFAULT_DOWNLOAD_WAIT = 2 # in minutes
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/download/http.py
Expand Up @@ -61,7 +61,7 @@
NotAvailableError,
)

logger = logging.getLogger("eodag.plugins.download.http")
logger = logging.getLogger("eodag.download.http")


class HTTPDownload(Download):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/download/s3rest.py
Expand Up @@ -50,7 +50,7 @@
RequestError,
)

logger = logging.getLogger("eodag.plugins.download.s3rest")
logger = logging.getLogger("eodag.download.s3rest")


class S3RestDownload(Download):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/manager.py
Expand Up @@ -32,7 +32,7 @@
from eodag.utils import GENERIC_PRODUCT_TYPE
from eodag.utils.exceptions import UnsupportedProvider

logger = logging.getLogger("eodag.plugins.manager")
logger = logging.getLogger("eodag.manager")


class PluginManager:
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/search/base.py
Expand Up @@ -25,7 +25,7 @@
from eodag.plugins.base import PluginTopic
from eodag.utils import GENERIC_PRODUCT_TYPE, format_dict_items

logger = logging.getLogger("eodag.plugins.search.base")
logger = logging.getLogger("eodag.search.base")


class Search(PluginTopic):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/search/build_search_result.py
Expand Up @@ -32,7 +32,7 @@
from eodag.plugins.search.qssearch import PostJsonSearch
from eodag.utils import dict_items_recursive_sort

logger = logging.getLogger("eodag.plugins.search.build_search_result")
logger = logging.getLogger("eodag.search.build_search_result")


class BuildPostSearchResult(PostJsonSearch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/search/csw.py
Expand Up @@ -37,7 +37,7 @@
from eodag.utils import DEFAULT_PROJ
from eodag.utils.import_system import patch_owslib_requests

logger = logging.getLogger("eodag.plugins.search.csw")
logger = logging.getLogger("eodag.search.csw")

SUPPORTED_REFERENCE_SCHEMES = ["WWW:DOWNLOAD-1.0-http--download"]

Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/search/qssearch.py
Expand Up @@ -50,7 +50,7 @@
)
from eodag.utils.exceptions import AuthenticationError, MisconfiguredError, RequestError

logger = logging.getLogger("eodag.plugins.search.qssearch")
logger = logging.getLogger("eodag.search.qssearch")


class QueryStringSearch(Search):
Expand Down
2 changes: 1 addition & 1 deletion eodag/plugins/search/static_stac_search.py
Expand Up @@ -28,7 +28,7 @@
from eodag.utils import HTTP_REQ_TIMEOUT, MockResponse
from eodag.utils.stac_reader import fetch_stac_items

logger = logging.getLogger("eodag.plugins.search.static_stac_search")
logger = logging.getLogger("eodag.search.static_stac_search")


class StaticStacSearch(StacSearch):
Expand Down
2 changes: 1 addition & 1 deletion eodag/utils/logging.py
Expand Up @@ -92,7 +92,7 @@ def setup_logging(verbose, no_progress_bar=False):
"formatters": {
"verbose": {
"format": (
"%(asctime)-15s %(name)-32s [%(levelname)-8s] (%(module)-17s tid=%(thread)d) %(message)s"
"%(asctime)-15s %(name)-32s [%(levelname)-8s] (tid=%(thread)d) %(message)s"
)
}
},
Expand Down
4 changes: 2 additions & 2 deletions tests/units/test_download_plugins.py
Expand Up @@ -530,8 +530,8 @@ def run():
plugin.orderDownloadStatus(self.product, auth=auth)
self.assertEqual(
[
f"INFO:eodag.plugins.download.http:{self.product.properties['title']} order status: 50%",
'WARNING:eodag.plugins.download.http:{"progress_percentage": 50, "that": "failed"}',
f"INFO:eodag.download.http:{self.product.properties['title']} order status: 50%",
'WARNING:eodag.download.http:{"progress_percentage": 50, "that": "failed"}',
],
cm.output,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/units/test_eoproduct.py
Expand Up @@ -505,7 +505,7 @@ def test_eoproduct_register_downloader_resolve_ok(self):
def test_eoproduct_register_downloader_resolve_ignored(self):
"""eoproduct.register_donwloader must ignore unresolvable locations and properties"""

logger = logging.getLogger("eodag.api.product")
logger = logging.getLogger("eodag.product")
with mock.patch.object(logger, "debug") as mock_debug:

downloadable_product = self._dummy_downloadable_product(
Expand Down
2 changes: 1 addition & 1 deletion tests/units/test_safe_build.py
Expand Up @@ -32,7 +32,7 @@ def setUp(self):
super(TestSafeBuild, self).setUp()

self.awsd = AwsDownload("some_provider", {})
self.logger = logging.getLogger("eodag.plugins.download.aws")
self.logger = logging.getLogger("eodag.download.aws")

self.tmp_download_dir = TemporaryDirectory()
self.tmp_download_path = self.tmp_download_dir.name
Expand Down
2 changes: 1 addition & 1 deletion tests/units/test_search_plugins.py
Expand Up @@ -471,7 +471,7 @@ def run():
responses.POST, self.awseos_url, status=500, body=b"test error message"
)

with self.assertLogs("eodag.plugins.search.qssearch", level="DEBUG") as cm:
with self.assertLogs("eodag.search.qssearch", level="DEBUG") as cm:
with self.assertRaises(RequestError):
products, estimate = self.awseos_search_plugin.query(
page=1,
Expand Down

0 comments on commit 93e61ca

Please sign in to comment.