Skip to content

Commit

Permalink
Add Logger representation
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Dec 20, 2024
1 parent e8cfa68 commit 5286868
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions tilecloud/filter/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ def __call__(self, tile: Optional[Tile]) -> Optional[Tile]:
variables.update(tile.tilecoord.__dict__)
self.logger.log(self.level, self.msgformat, variables, *self.args, **self.kwargs)
return tile

def __str__(self) -> str:
return f"{self.logger.name}({self.level}, {self.msgformat})"

def __repr__(self) -> str:
return self.__str__()
2 changes: 1 addition & 1 deletion tilecloud/store/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def put_one(self, tile: Tile) -> Tile:
ACL="public-read", Body=tile.data, Key=key_name, Bucket=self.bucket, **args
)
except botocore.exceptions.ClientError as exc:
_LOGGER.warning("Error while putting tile %s", tile, exec_info=True)
_LOGGER.warning("Error while putting tile %s", tile, exc_info=True)
tile.error = exc
return tile

Expand Down
4 changes: 2 additions & 2 deletions tilecloud/store/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_one(self, tile: Tile) -> Optional[Tile]:
try:
url = tilelayout.filename(tile.tilecoord, tile.metadata)
except Exception as exception: # pylint: disable=broad-except
_LOGGER.warning("Error while getting tile %s", tile, exec_info=True)
_LOGGER.warning("Error while getting tile %s", tile, exc_info=True)
tile.error = exception
return tile

Expand Down Expand Up @@ -65,7 +65,7 @@ def get_one(self, tile: Tile) -> Optional[Tile]:
else:
tile.error = f"URL: {url}\n{response.status_code}: {response.reason}\n{response.text}"
except requests.exceptions.RequestException as exception:
_LOGGER.warning("Error while getting tile %s", tile, exec_info=True)
_LOGGER.warning("Error while getting tile %s", tile, exc_info=True)
tile.error = exception
return tile

Expand Down

0 comments on commit 5286868

Please sign in to comment.