From 9361726668c9f86504845de4c4ad2eac7287a2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 18 Dec 2024 15:32:42 +0100 Subject: [PATCH] Add more information in the debug logs --- tilecloud_chain/generate.py | 6 ++++++ tilecloud_chain/multitilestore.py | 10 ++++++---- tilecloud_chain/timedtilestore.py | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tilecloud_chain/generate.py b/tilecloud_chain/generate.py index f87656c61..649026d86 100644 --- a/tilecloud_chain/generate.py +++ b/tilecloud_chain/generate.py @@ -543,6 +543,12 @@ def __call__(self, config_file: str, layer_name: str) -> TileStore | None: ) return None + def __str__(self) -> str: + return self.__class__.__name__ + + def __repr__(self) -> str: + return self.__str__() + def detach() -> None: """Detach to the parent process.""" diff --git a/tilecloud_chain/multitilestore.py b/tilecloud_chain/multitilestore.py index 1f6cc1fb1..cef73bc61 100644 --- a/tilecloud_chain/multitilestore.py +++ b/tilecloud_chain/multitilestore.py @@ -116,13 +116,15 @@ def apply(key: tuple[str, str], tiles: Iterator[Tile]) -> Iterator[Tile]: def __str__(self) -> str: """Return a string representation of the object.""" - stores = {str(store) for store in self.stores.values() if store is not None} - return f"{self.__class__.__name__}({', '.join(stores)})" + stores = {str(store) for store in self.stores.values()} + keys = {f"{config_file}/{layer}" for config_file, layer in self.stores} + return f"{self.__class__.__name__}({', '.join(stores)} - {', '.join(keys)})" def __repr__(self) -> str: """Return a string representation of the object.""" - stores = {repr(store) for store in self.stores.values() if store is not None} - return f"{self.__class__.__name__}({', '.join(stores)})" + stores = {repr(store) for store in self.stores.values()} + keys = {f"{config_file}/{layer}" for config_file, layer in self.stores} + return f"{self.__class__.__name__}({', '.join(stores)} - {', '.join(keys)})" @staticmethod def _get_layer(tile: Tile | None) -> tuple[str, str]: diff --git a/tilecloud_chain/timedtilestore.py b/tilecloud_chain/timedtilestore.py index 699c93578..47ccba2c4 100644 --- a/tilecloud_chain/timedtilestore.py +++ b/tilecloud_chain/timedtilestore.py @@ -121,8 +121,8 @@ def get_cheap_bounding_pyramid(self) -> BoundingPyramid | None: def __str__(self) -> str: """Get string representation.""" - return f"{self.__class__.__name__}({self._tile_store}" + return f"{self.__class__.__name__}({self._store_name}: {self._tile_store}" def __repr__(self) -> str: """Get string representation.""" - return f"{self.__class__.__name__}({self._tile_store!r})" + return f"{self.__class__.__name__}({self._store_name}: {self._tile_store!r})"