in azure_functions_worker/extension.py [0:0]
def _safe_execute_invocation_hooks(cls, hooks, hook_name, ctx, fargs, fret):
# hooks from azure.functions.ExtensionMeta.get_function_hooks() or
# azure.functions.ExtensionMeta.get_application_hooks()
if hooks:
# Invoke extension implementation from .<hook_name>.ext_impl
for hook_meta in getattr(hooks, hook_name, []):
# Register a system logger with prefix azure_functions_worker
ext_logger = logging.getLogger(
f'{SYSTEM_LOG_PREFIX}.extension.{hook_meta.ext_name}'
)
try:
if cls._is_pre_invocation_hook(hook_name):
hook_meta.ext_impl(ext_logger, ctx, fargs)
elif cls._is_post_invocation_hook(hook_name):
hook_meta.ext_impl(ext_logger, ctx, fargs, fret)
except Exception as e:
ext_logger.error(e, exc_info=True)