From b2355107f3d8f8af1b4a4f325c32b13a47ab9a81 Mon Sep 17 00:00:00 2001 From: Milan Parmar Date: Mon, 3 Aug 2026 22:42:11 +0530 Subject: [PATCH] chore(logging): add utils/logging_config.py --- utils/logging_config.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 utils/logging_config.py diff --git a/utils/logging_config.py b/utils/logging_config.py new file mode 100644 index 0000000..0f5ef8f --- /dev/null +++ b/utils/logging_config.py @@ -0,0 +1,18 @@ +import logging + +LOG_FORMAT = "%(asctime)s %(levelname)s [%(name)s] %(message)s" +logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) +# reduce noise from overly-verbose libraries +logging.getLogger("urllib3").setLevel(logging.WARNING) +logging.getLogger("PIL").setLevel(logging.WARNING) + +# Expose a convenience function for other modules to use when they want +# to ensure logging is configured (idempotent). + +def configure_logging(level: int = logging.INFO) -> None: + """Configure root logging for the application. + + This is safe to call multiple times; subsequent calls will not reconfigure + handlers if they've already been set up by basicConfig. + """ + logging.getLogger().setLevel(level)