diff options
| author | Frederick Muriuki Muriithi | 2026-04-20 14:44:51 -0500 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2026-04-20 14:44:51 -0500 |
| commit | c7499016156439f720dc45fd13cfb4d14d23e761 (patch) | |
| tree | 5f27e1c7d222dac8b3799e8ea73e60d607ace199 | |
| parent | 4e0fe0e12ab01d9cdbaf2d7a53a4f4ac8f6feb91 (diff) | |
| download | gn-auth-c7499016156439f720dc45fd13cfb4d14d23e761.tar.gz | |
Use module-level logger rather than application's logger.
| -rw-r--r-- | gn_auth/auth/authorisation/resources/views.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py index 4b6c36c..4235d87 100644 --- a/gn_auth/auth/authorisation/resources/views.py +++ b/gn_auth/auth/authorisation/resources/views.py @@ -1,9 +1,10 @@ """The views/routes for the resources package""" -from uuid import UUID, uuid4 +import time import json +import logging import operator import sqlite3 -import time +from uuid import UUID, uuid4 from dataclasses import asdict from functools import reduce @@ -52,6 +53,8 @@ from .models import ( unlink_data_from_resource, create_resource as _create_resource, get_resource_id, delete_resource as _delete_resource) +logger = logging.getLogger(__name__) + resources = Blueprint("resources", __name__) resources.register_blueprint(popbp, url_prefix="/") resources.register_blueprint(genobp, url_prefix="/") @@ -95,7 +98,7 @@ def create_resource() -> Response: "resources.resource_name"): raise InconsistencyError( "You cannot have duplicate resource names.") from sql3ie - app.logger.debug( + logger.debug( f"{type(sql3ie)=}: {sql3ie=}") raise @@ -468,7 +471,7 @@ def resources_authorisation(): }) resp.status_code = 400 except Exception as _exc:#pylint: disable=[broad-except] - app.logger.debug("Generic exception.", exc_info=True) + logger.debug("Generic exception.", exc_info=True) resp = jsonify({ "status": "general-exception", "error_description": ( @@ -705,13 +708,13 @@ def delete_resource(): "description": f"Successfully deleted resource with ID '{resource_id}'." }) except ValueError as _verr: - app.logger.debug("Error!", exc_info=True) + logger.debug("Error!", exc_info=True) return jsonify({ "error": "ValueError", "error-description": "An invalid identifier was provided" }), 400 except TypeError as _terr: - app.logger.debug("Error!", exc_info=True) + logger.debug("Error!", exc_info=True) return jsonify({ "error": "TypeError", "error-description": "An invalid identifier was provided" |
