From 8f8d678497921ba6d45e41547841a49bc1ff458b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 13 Apr 2026 13:53:04 -0500 Subject: Add module-level logging. --- uploader/request_checks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/uploader/request_checks.py b/uploader/request_checks.py index f1d8027..93bc902 100644 --- a/uploader/request_checks.py +++ b/uploader/request_checks.py @@ -2,6 +2,8 @@ These are useful for reusability, and hence maintainability of the code. """ +import logging + from functools import wraps from gn_libs.mysqldb import database_connection @@ -10,6 +12,9 @@ from flask import flash, url_for, redirect, current_app as app from uploader.species.models import species_by_id from uploader.population.models import population_by_species_and_id +logger = logging.getLogger(__name__) + + def with_species(redirect_uri: str): """Ensure the species actually exists.""" def __decorator__(function): @@ -28,7 +33,7 @@ def with_species(redirect_uri: str): "alert-danger") return redirect(url_for(redirect_uri)) except ValueError as _verr: - app.logger.debug( + logger.debug( "Exception converting value to integer: %s", kwargs.get("species_id"), exc_info=True) @@ -63,7 +68,7 @@ def with_population(species_redirect_uri: str, redirect_uri: str): "alert-danger") return select_population_uri except ValueError as _verr: - app.logger.debug( + logger.debug( "Exception converting value to integer: %s", kwargs.get("population_id"), exc_info=True) -- cgit 1.4.1