From 5c25635a77c37570bb3307ff1062eef5d769e19b Mon Sep 17 00:00:00 2001 From: rettigl Date: Fri, 26 Jul 2024 22:03:24 +0200 Subject: [PATCH] use pynxtools logger, and consistently use this logger --- pynxtools_mpes/reader.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pynxtools_mpes/reader.py b/pynxtools_mpes/reader.py index 493f92b..f0cdc62 100644 --- a/pynxtools_mpes/reader.py +++ b/pynxtools_mpes/reader.py @@ -29,8 +29,7 @@ from pynxtools_mpes.mappings import CONVERT_DICT, DEFAULT_UNITS, REPLACE_NESTED -logger = logging.getLogger(__name__) -logger.setLevel(logging.INFO) +logger = logging.getLogger("pynxtools") def recursive_parse_metadata( @@ -228,7 +227,7 @@ def handle_objects(self, objects: Tuple[Any]) -> Dict[str, Any]: self.data_xarray = objects[0] return {} - logging.info( + logger.info( f"Error while reading objects: {objects} does not contain an xarray object." " Skipping the objects." ) @@ -242,10 +241,10 @@ def get_data(self, key: str, path: str) -> Any: return value except ValueError: - print(f"Incorrect axis name corresponding to the path {path}") + logger.warning(f"Incorrect axis name corresponding to the path {path}") except AttributeError: - print( + logger.warning( "Incorrect naming syntax or the xarray doesn't " f"contain entry corresponding to the path {path}" ) @@ -257,7 +256,7 @@ def get_attr(self, key: str, path: str) -> Any: try: return iterate_dictionary(self.data_xarray.attrs, path) except KeyError: - logging.info(f"Path {path} not found. Skipping the entry.") + logger.info(f"Path {path} not found. Skipping the entry.") READER = MPESReader