From 205d873d867e2bb30b225da95377005f5d6214bf Mon Sep 17 00:00:00 2001 From: ff137 Date: Wed, 27 Nov 2024 14:10:15 +0200 Subject: [PATCH] :construction: Test debug logs (review/remove later) Signed-off-by: ff137 --- acapy_agent/core/goal_code_registry.py | 4 ++++ acapy_agent/core/protocol_registry.py | 5 +++++ acapy_agent/messaging/models/base.py | 1 + 3 files changed, 10 insertions(+) diff --git a/acapy_agent/core/goal_code_registry.py b/acapy_agent/core/goal_code_registry.py index 3fd8ace900..4e48099fdb 100644 --- a/acapy_agent/core/goal_code_registry.py +++ b/acapy_agent/core/goal_code_registry.py @@ -1,9 +1,12 @@ """Handle registration and publication of supported goal codes.""" +import logging from typing import Sequence from ..utils.classloader import ClassLoader +LOGGER = logging.getLogger(__name__) + class GoalCodeRegistry: """Goal code registry.""" @@ -19,6 +22,7 @@ def register_controllers(self, *controller_sets): controller_sets: Mappings of controller to coroutines """ + LOGGER.debug("Registering controllers for goal codes") for controlset in controller_sets: for key, ctl_cls in controlset.items(): ctl_cls = ClassLoader.load_class(ctl_cls) diff --git a/acapy_agent/core/protocol_registry.py b/acapy_agent/core/protocol_registry.py index 18a1623015..0b2d203f3e 100644 --- a/acapy_agent/core/protocol_registry.py +++ b/acapy_agent/core/protocol_registry.py @@ -207,22 +207,27 @@ async def prepare_disclosed( self, context: InjectionContext, protocols: Sequence[str] ): """Call controllers and return publicly supported message families and roles.""" + LOGGER.debug("Preparing disclosed protocols") published = [] for protocol in protocols: + LOGGER.debug("Processing protocol: %s", protocol) result: Dict[str, Any] = {"pid": protocol} if protocol in self._controllers: ctl_cls = self._controllers[protocol] if isinstance(ctl_cls, str): + LOGGER.debug("Loading controller class: %s", ctl_cls) ctl_cls = ClassLoader.load_class(ctl_cls) ctl_instance = ctl_cls(protocol) if hasattr(ctl_instance, "check_access"): allowed = await ctl_instance.check_access(context) if not allowed: + LOGGER.debug("Access check failed for protocol: %s", protocol) # remove from published continue if hasattr(ctl_instance, "determine_roles"): roles = await ctl_instance.determine_roles(context) if roles: + LOGGER.debug("Found roles for protocol %s: %s", protocol, roles) result["roles"] = list(roles) published.append(result) return published diff --git a/acapy_agent/messaging/models/base.py b/acapy_agent/messaging/models/base.py index d9b17231a3..c6a9949a95 100644 --- a/acapy_agent/messaging/models/base.py +++ b/acapy_agent/messaging/models/base.py @@ -36,6 +36,7 @@ def resolve_class(the_cls, relative_cls: Optional[type] = None) -> type: resolved = the_cls elif isinstance(the_cls, str): default_module = relative_cls and relative_cls.__module__ + LOGGER.debug("Loading class %s from module %s", the_cls, default_module) resolved = ClassLoader.load_class(the_cls, default_module) else: raise TypeError(