From 25af8f73dae36cc6c37597292f8b6aa92abd1a77 Mon Sep 17 00:00:00 2001 From: Riku Oja Date: Fri, 22 Nov 2024 15:02:21 +0200 Subject: [PATCH] Improve logging --- database/ryhti_client/ryhti_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/ryhti_client/ryhti_client.py b/database/ryhti_client/ryhti_client.py index 1e92837..829a3ca 100644 --- a/database/ryhti_client/ryhti_client.py +++ b/database/ryhti_client/ryhti_client.py @@ -200,6 +200,7 @@ def __init__( plan_uuid: Optional[str] = None, debug_json: Optional[bool] = False, # save JSON files for debugging ) -> None: + LOGGER.info("Initializing Ryhti client...") self.event_type = event_type self.debug_json = debug_json @@ -267,17 +268,16 @@ def __init__( # Otherwise, we may access old plan data without having to create a session # and query. with self.Session(expire_on_commit=False) as session: + LOGGER.info("Caching requested plans from database...") # Only process specified plans plan_query: Query = session.query(models.Plan) if plan_uuid: + LOGGER.info(f"Only fetching plan {plan_uuid}") plan_query = plan_query.filter_by(id=plan_uuid) self.plans = {plan.id: plan for plan in plan_query.all()} - print(plan_query.all()) if not self.plans: - print("no plans") LOGGER.info("No plans found in database.") else: - print("got plans") LOGGER.info("Client initialized with plans to process:") LOGGER.info(self.plans)