From 4c1df02a9be2f8d3cf674cbc96b2b498f26277d6 Mon Sep 17 00:00:00 2001 From: Renaud <38732257+renaudjester@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:44:47 +0200 Subject: [PATCH] chore: change name logger to fit with the name of the library (#97) Renamed the logger to `copernicusmarine` to fit with the convention that the logger is usually with the same name as the library --- copernicusmarine/catalogue_parser/catalogue_parser.py | 2 +- copernicusmarine/catalogue_parser/request_structure.py | 2 +- copernicusmarine/command_line_interface/exception_handler.py | 2 +- copernicusmarine/command_line_interface/group_describe.py | 4 ++-- copernicusmarine/command_line_interface/group_get.py | 2 +- copernicusmarine/command_line_interface/group_login.py | 2 +- copernicusmarine/command_line_interface/group_subset.py | 2 +- copernicusmarine/core_functions/credentials_utils.py | 2 +- copernicusmarine/core_functions/custom_open_zarr.py | 2 +- copernicusmarine/core_functions/deprecated.py | 2 +- copernicusmarine/core_functions/describe.py | 2 +- copernicusmarine/core_functions/environment_variables.py | 2 +- copernicusmarine/core_functions/get.py | 2 +- copernicusmarine/core_functions/login.py | 2 +- copernicusmarine/core_functions/services_utils.py | 2 +- copernicusmarine/core_functions/subset.py | 2 +- copernicusmarine/core_functions/utils.py | 2 +- copernicusmarine/core_functions/versions_verifier.py | 2 +- copernicusmarine/download_functions/common_download.py | 2 +- copernicusmarine/download_functions/download_arco_series.py | 2 +- .../download_functions/download_original_files.py | 4 ++-- copernicusmarine/download_functions/subset_xarray.py | 2 +- copernicusmarine/download_functions/utils.py | 2 +- copernicusmarine/logging_conf.py | 4 ++-- 24 files changed, 27 insertions(+), 27 deletions(-) diff --git a/copernicusmarine/catalogue_parser/catalogue_parser.py b/copernicusmarine/catalogue_parser/catalogue_parser.py index a607387c..9b2b5a8f 100644 --- a/copernicusmarine/catalogue_parser/catalogue_parser.py +++ b/copernicusmarine/catalogue_parser/catalogue_parser.py @@ -33,7 +33,7 @@ rolling_batch_gather, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") MARINE_DATA_STORE_STAC_BASE_URL = ( diff --git a/copernicusmarine/catalogue_parser/request_structure.py b/copernicusmarine/catalogue_parser/request_structure.py index 6e90ec89..531c4e27 100644 --- a/copernicusmarine/catalogue_parser/request_structure.py +++ b/copernicusmarine/catalogue_parser/request_structure.py @@ -23,7 +23,7 @@ TemporalParameters, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") MAPPING_REQUEST_FILES_AND_REQUEST_OPTIONS: dict[str, str] = { diff --git a/copernicusmarine/command_line_interface/exception_handler.py b/copernicusmarine/command_line_interface/exception_handler.py index 5b1cd559..ef286388 100644 --- a/copernicusmarine/command_line_interface/exception_handler.py +++ b/copernicusmarine/command_line_interface/exception_handler.py @@ -5,7 +5,7 @@ from sys import exit from typing import Callable -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def _log_exception(log_function: Callable, exception: Exception): diff --git a/copernicusmarine/command_line_interface/group_describe.py b/copernicusmarine/command_line_interface/group_describe.py index 3abe2bfa..9099e053 100644 --- a/copernicusmarine/command_line_interface/group_describe.py +++ b/copernicusmarine/command_line_interface/group_describe.py @@ -12,8 +12,8 @@ ) from copernicusmarine.core_functions.describe import describe_function -logger = logging.getLogger("copernicus_marine_root_logger") -blank_logger = logging.getLogger("copernicus_marine_blank_logger") +logger = logging.getLogger("copernicusmarine") +blank_logger = logging.getLogger("copernicusmarine_blank_logger") @click.group() diff --git a/copernicusmarine/command_line_interface/group_get.py b/copernicusmarine/command_line_interface/group_get.py index d01e8e17..681a05cb 100644 --- a/copernicusmarine/command_line_interface/group_get.py +++ b/copernicusmarine/command_line_interface/group_get.py @@ -29,7 +29,7 @@ OVERWRITE_SHORT_OPTION, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") @click.group() diff --git a/copernicusmarine/command_line_interface/group_login.py b/copernicusmarine/command_line_interface/group_login.py index c8bee683..99030023 100644 --- a/copernicusmarine/command_line_interface/group_login.py +++ b/copernicusmarine/command_line_interface/group_login.py @@ -12,7 +12,7 @@ ) from copernicusmarine.core_functions.login import login_function -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") @click.group() diff --git a/copernicusmarine/command_line_interface/group_subset.py b/copernicusmarine/command_line_interface/group_subset.py index 6d9d0a3f..f53a4d94 100644 --- a/copernicusmarine/command_line_interface/group_subset.py +++ b/copernicusmarine/command_line_interface/group_subset.py @@ -38,7 +38,7 @@ OVERWRITE_SHORT_OPTION, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") @click.group() diff --git a/copernicusmarine/core_functions/credentials_utils.py b/copernicusmarine/core_functions/credentials_utils.py index 92987dae..2d23304f 100644 --- a/copernicusmarine/core_functions/credentials_utils.py +++ b/copernicusmarine/core_functions/credentials_utils.py @@ -19,7 +19,7 @@ get_configured_requests_session, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") USER_DEFINED_CACHE_DIRECTORY: str = ( COPERNICUSMARINE_CREDENTIALS_DIRECTORY or "" diff --git a/copernicusmarine/core_functions/custom_open_zarr.py b/copernicusmarine/core_functions/custom_open_zarr.py index a8947570..4e935766 100644 --- a/copernicusmarine/core_functions/custom_open_zarr.py +++ b/copernicusmarine/core_functions/custom_open_zarr.py @@ -16,7 +16,7 @@ ) from copernicusmarine.core_functions.utils import parse_access_dataset_url -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") class CustomS3Store(MutableMapping): diff --git a/copernicusmarine/core_functions/deprecated.py b/copernicusmarine/core_functions/deprecated.py index 48e8ed75..8af3a160 100644 --- a/copernicusmarine/core_functions/deprecated.py +++ b/copernicusmarine/core_functions/deprecated.py @@ -5,7 +5,7 @@ import click -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def get_deprecated_message(old_value, preferred_value): diff --git a/copernicusmarine/core_functions/describe.py b/copernicusmarine/core_functions/describe.py index b62bd091..d2c72de8 100644 --- a/copernicusmarine/core_functions/describe.py +++ b/copernicusmarine/core_functions/describe.py @@ -11,7 +11,7 @@ ) from copernicusmarine.core_functions.versions_verifier import VersionVerifier -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def describe_function( diff --git a/copernicusmarine/core_functions/environment_variables.py b/copernicusmarine/core_functions/environment_variables.py index d5181bd7..b3c9ae3d 100644 --- a/copernicusmarine/core_functions/environment_variables.py +++ b/copernicusmarine/core_functions/environment_variables.py @@ -1,7 +1,7 @@ import logging import os -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") COPERNICUSMARINE_SERVICE_USERNAME = os.getenv( "COPERNICUSMARINE_SERVICE_USERNAME" diff --git a/copernicusmarine/core_functions/get.py b/copernicusmarine/core_functions/get.py index 5e71d87f..d8a99ad5 100644 --- a/copernicusmarine/core_functions/get.py +++ b/copernicusmarine/core_functions/get.py @@ -23,7 +23,7 @@ download_original_files, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def get_function( diff --git a/copernicusmarine/core_functions/login.py b/copernicusmarine/core_functions/login.py index 6635d017..0c21b104 100644 --- a/copernicusmarine/core_functions/login.py +++ b/copernicusmarine/core_functions/login.py @@ -8,7 +8,7 @@ credentials_file_builder, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def login_function( diff --git a/copernicusmarine/core_functions/services_utils.py b/copernicusmarine/core_functions/services_utils.py index 5e2ad010..be41d88d 100644 --- a/copernicusmarine/core_functions/services_utils.py +++ b/copernicusmarine/core_functions/services_utils.py @@ -29,7 +29,7 @@ get_size_of_coordinate_subset, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") class _Command(Enum): diff --git a/copernicusmarine/core_functions/subset.py b/copernicusmarine/core_functions/subset.py index 172c547e..6b7f0c3e 100644 --- a/copernicusmarine/core_functions/subset.py +++ b/copernicusmarine/core_functions/subset.py @@ -34,7 +34,7 @@ ) from copernicusmarine.download_functions.utils import FileFormat -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def subset_function( diff --git a/copernicusmarine/core_functions/utils.py b/copernicusmarine/core_functions/utils.py index 564df704..0854e8e1 100644 --- a/copernicusmarine/core_functions/utils.py +++ b/copernicusmarine/core_functions/utils.py @@ -26,7 +26,7 @@ from copernicusmarine import __version__ as copernicusmarine_version -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") OVERWRITE_SHORT_OPTION = "--overwrite" OVERWRITE_LONG_OPTION = "--overwrite-output-data" diff --git a/copernicusmarine/core_functions/versions_verifier.py b/copernicusmarine/core_functions/versions_verifier.py index 5878db6a..af3124c6 100644 --- a/copernicusmarine/core_functions/versions_verifier.py +++ b/copernicusmarine/core_functions/versions_verifier.py @@ -10,7 +10,7 @@ construct_query_params_for_marine_data_store_monitoring, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") class VersionVerifier: diff --git a/copernicusmarine/download_functions/common_download.py b/copernicusmarine/download_functions/common_download.py index 4316354c..16d36ce2 100644 --- a/copernicusmarine/download_functions/common_download.py +++ b/copernicusmarine/download_functions/common_download.py @@ -11,7 +11,7 @@ NetCDFCompressionNotAvailable, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def get_delayed_download( diff --git a/copernicusmarine/download_functions/download_arco_series.py b/copernicusmarine/download_functions/download_arco_series.py index 1d70b4da..8ecac34e 100644 --- a/copernicusmarine/download_functions/download_arco_series.py +++ b/copernicusmarine/download_functions/download_arco_series.py @@ -34,7 +34,7 @@ get_formatted_dataset_size_estimation, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def _rechunk(dataset: xarray.Dataset) -> xarray.Dataset: diff --git a/copernicusmarine/download_functions/download_original_files.py b/copernicusmarine/download_functions/download_original_files.py index 2aa2b2e0..b6d7e29c 100644 --- a/copernicusmarine/download_functions/download_original_files.py +++ b/copernicusmarine/download_functions/download_original_files.py @@ -30,8 +30,8 @@ parse_access_dataset_url, ) -logger = logging.getLogger("copernicus_marine_root_logger") -blank_logger = logging.getLogger("copernicus_marine_blank_logger") +logger = logging.getLogger("copernicusmarine") +blank_logger = logging.getLogger("copernicusmarine_blank_logger") NUMBER_THREADS = ( int(COPERNICUSMARINE_GET_CONCURRENT_DOWNLOADS) diff --git a/copernicusmarine/download_functions/subset_xarray.py b/copernicusmarine/download_functions/subset_xarray.py index 0d080bdd..0a5e8660 100644 --- a/copernicusmarine/download_functions/subset_xarray.py +++ b/copernicusmarine/download_functions/subset_xarray.py @@ -33,7 +33,7 @@ TemporalParameters, ) -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") COORDINATES_LABEL = { "latitude": ["latitude", "nav_lat", "x", "lat"], diff --git a/copernicusmarine/download_functions/utils.py b/copernicusmarine/download_functions/utils.py index 7a23100f..762377e8 100644 --- a/copernicusmarine/download_functions/utils.py +++ b/copernicusmarine/download_functions/utils.py @@ -12,7 +12,7 @@ ) from copernicusmarine.download_functions.subset_xarray import COORDINATES_LABEL -logger = logging.getLogger("copernicus_marine_root_logger") +logger = logging.getLogger("copernicusmarine") def get_file_extension(file_format: FileFormat) -> str: diff --git a/copernicusmarine/logging_conf.py b/copernicusmarine/logging_conf.py index ac201d7b..9a763c30 100644 --- a/copernicusmarine/logging_conf.py +++ b/copernicusmarine/logging_conf.py @@ -22,12 +22,12 @@ }, }, "loggers": { - "copernicus_marine_blank_logger": { + "copernicusmarine_blank_logger": { "handlers": ["console_blank"], "level": "INFO", "propagate": False, }, - "copernicus_marine_root_logger": { + "copernicusmarine": { "handlers": ["console"], "level": "INFO", },