Skip to content

Commit

Permalink
adds logging to try except in collection.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCoelhoSL committed Dec 3, 2024
1 parent 6e94e3c commit ddd3688
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions digital_land/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# rename and change variable
DEFAULT_COLLECTION_DIR = "./collection"

logger = logging.getLogger("__name__")


def isodate(s):
return datetime.fromisoformat(s).strftime("%Y-%m-%d")
Expand Down Expand Up @@ -116,6 +118,7 @@ def load(
source: CSVStore,
directory: str = DEFAULT_COLLECTION_DIR,
after: datetime = None,
logging: bool = False,
):
"""
Rebuild or update resource.csv file from the log store.
Expand Down Expand Up @@ -178,9 +181,10 @@ def load(
# This occurs when there is a log for an endpoint, but the endpoint isn't in endpoint.csv/source.csv
# This can happen when there is an unsuccessful attempt to add an endpoint and the log still exists
# In this case we don't want to load this endpoint so skip
print(
f"Log for endpoint {endpoint} detected but endpoint is not in source.csv"
)
if logging:
logging.error(
f"Log for endpoint {endpoint} detected but endpoint is not in source.csv"
)
continue

new_entries[key] = {
Expand Down

0 comments on commit ddd3688

Please sign in to comment.