Przeglądaj źródła

Add some logging + format

jherve 1 rok temu
rodzic
commit
53cf759f66
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      src/de_quoi_parle_le_monde/snapshot_worker.py

+ 5 - 1
src/de_quoi_parle_le_monde/snapshot_worker.py

@@ -84,15 +84,19 @@ class SnapshotWorker:
 
     async def handle_snap(self, collection, dt):
         try:
+            logger.info(f"Start handling snap for collection {collection.url} @ {dt}")
             id_closest = await self.find(collection, dt)
             closest = await self.ia_client.fetch(id_closest)
             main_page = await self.parse(collection, closest)
             await self.store(main_page, collection, dt)
+            logger.info(f"Snap for collection {collection.url} @ {dt} is stored")
         except Exception as e:
             return
 
 
-async def download_all(http_client: HttpClient, storage: Storage, n_days: int, hours: list[int]):
+async def download_all(
+    http_client: HttpClient, storage: Storage, n_days: int, hours: list[int]
+):
     dts = SnapshotWorker.last_n_days_at_hours(n_days, hours)
 
     async with http_client.session() as session: