From 56657036e480520b27ddfc84fe17a30f9a7e7ed0 Mon Sep 17 00:00:00 2001 From: "Maxime Alves LIRMM@home" Date: Wed, 4 Nov 2020 13:32:33 +0100 Subject: [PATCH] Added logging for acls --- halfapi/lib/routes.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index 9660949..c65c788 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 from functools import wraps +import logging from typing import Callable, List, Dict, Generator from types import ModuleType, FunctionType @@ -9,6 +10,9 @@ from starlette.requests import Request from halfapi.lib.domain import gen_domain_routes, VERBS + +logger = logging.getLogger('uvicorn.asgi') + class DomainNotFoundError(Exception): pass @@ -38,8 +42,12 @@ def route_acl_decorator(fct: Callable, params: List[Dict]): passed = param['acl']()(req, *args, **kwargs) if not passed: + logger.debug( + f'ACL FAIL for current route ({fct} - {param.get("acl")})') continue + logger.debug(f'ACL OK for current route ({fct} - {param.get("acl")})') + return await fct( req, *args, **{