Skip to content

Commit bbbf56c

Browse files
committed
Add collection name and id to opds import log messages for easier debugging.
1 parent f9efdc6 commit bbbf56c

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

src/palace/manager/celery/opds.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def opds_import_task[FeedType](
5757
)
5858

5959
if not import_result:
60-
task.log.info("Import failed, aborting task.")
60+
task.log.info(
61+
f"Import failed, aborting task for collection '{collection.name}' (id={collection.id})"
62+
)
6163
return None
6264

6365
# If a post-import hook is provided, call it with the import result.
@@ -81,8 +83,11 @@ def opds_import_task[FeedType](
8183

8284
if not should_continue:
8385
task.log.info(
84-
f"Found unchanged publications in feed, stopping import without harvesting the rest of the feed."
86+
f"Found unchanged publications in feed, stopping import without harvesting the rest of the feed"
87+
f" for collection '{collection.name}' (id={collection.id}) "
8588
)
8689

87-
task.log.info("Import complete.")
90+
task.log.info(
91+
f"Import complete for collection '{collection.name}' (id={collection.id})"
92+
)
8893
return identifier_set

src/palace/manager/celery/tasks/opds_odl.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ def import_collection(
345345
)
346346

347347
if not import_result:
348-
task.log.info("Import failed, aborting task.")
348+
task.log.info(
349+
f"Import failed, aborting task for collection '{collection.name}' (id={collection_id})."
350+
)
349351
return
350352

351353
next_link = import_result.next_url
@@ -360,4 +362,6 @@ def import_collection(
360362
)
361363
)
362364

363-
task.log.info("Import complete.")
365+
task.log.info(
366+
f"Import complete for collection '{collection.name}' (id={collection_id})."
367+
)

src/palace/manager/integration/license/opds/importer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ def import_feed(
358358
feed = self._fetch_feed(feed_url)
359359
except ValueError as e:
360360
self.log.error(
361-
f"Failed to fetch or parse the feed from '{feed_url}': {e}",
361+
f"Failed to fetch or parse the feed from '{feed_url}' "
362+
f"for collection '{collection.name}' (id={collection.id}): {e}",
362363
exc_info=e,
363364
)
364365
return False
@@ -405,11 +406,13 @@ def import_feed(
405406

406407
if failures:
407408
self.log.error(
408-
f"Failed to import {len(failures)} publications from '{feed_url}'."
409+
f"Failed to import {len(failures)} publications from '{feed_url}' "
410+
f"for collection '{collection.name}' (id={collection.id})."
409411
)
410412
for failure in failures:
411413
self.log.error(
412-
f"Failed to import publication: {failure.identifier} ({failure.title})"
414+
f"Failed to import publication: {failure.identifier} ({failure.title}) "
415+
f"for collection '{collection.name}' (id={collection.id})"
413416
f" - {failure.error_message}: {failure.error}",
414417
exc_info=failure.error,
415418
extra={"palace_publication_data": failure.publication_data},

0 commit comments

Comments
 (0)