Skip to content

Commit

Permalink
🚧 Test debug logs (review/remove later)
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Nov 27, 2024
1 parent 1ca5f26 commit 205d873
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions acapy_agent/core/goal_code_registry.py
Original file line number Diff line number Diff line change
@@ -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."""
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions acapy_agent/core/protocol_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions acapy_agent/messaging/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 205d873

Please sign in to comment.