nat.middleware.logging.logging_middleware#

Attributes#

Classes#

LoggingMiddleware

Middleware that logs intercepted function inputs/outputs.

Module Contents#

logger#
class LoggingMiddleware(
config: nat.middleware.logging.logging_middleware_config.LoggingMiddlewareConfig,
builder: nat.builder.builder.Builder,
)#

Bases: nat.middleware.dynamic.dynamic_function_middleware.DynamicFunctionMiddleware

Middleware that logs intercepted function inputs/outputs.

This middleware extends DynamicFunctionMiddleware to get automatic chain orchestration and dynamic discovery features. Custom logic is implemented through the pre_invoke and post_invoke hooks.

Initialize logging middleware.

Args:

config: Logging middleware configuration builder: Workflow builder

_config: nat.middleware.logging.logging_middleware_config.LoggingMiddlewareConfig#
async pre_invoke(
context: nat.middleware.middleware.InvocationContext,
) nat.middleware.middleware.InvocationContext | None#

Log inputs before function execution.

Returns:

None to pass through unchanged (logging only, no modification)

async post_invoke(
context: nat.middleware.middleware.InvocationContext,
) nat.middleware.middleware.InvocationContext | None#

Log outputs after function execution.

Returns:

None to pass through unchanged (logging only, no modification)