From 767a6087a8e75217175ba7715991a2c51f33d625 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 2 Feb 2023 17:46:21 +0100 Subject: [PATCH] Improve logging --- unimore_bda_6/database.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unimore_bda_6/database.py b/unimore_bda_6/database.py index 8fd0605..fd152f4 100644 --- a/unimore_bda_6/database.py +++ b/unimore_bda_6/database.py @@ -30,15 +30,15 @@ def mongo_client_from_config() -> t.ContextManager[pymongo.MongoClient]: Create a new MongoDB client and yield it. """ log.debug("Opening connection to MongoDB...") - client = pymongo.MongoClient( + client: pymongo.MongoClient = pymongo.MongoClient( host=MONGO_HOST.__wrapped__, port=MONGO_PORT.__wrapped__, ) - log.info("Opened connection to MongoDB: %s", client) + log.info("Opened connection to MongoDB at %s!", client.address) yield client - log.info("Closing connection to MongoDB: %s", client) + log.info("Closing connection to MongoDB...") client.close() log.debug("Closed connection to MongoDB!")