ni_grpc_extensions.loggers

gRPC logging interceptors.

Classes

ClientLogger

Intercepts gRPC client calls and logs them for debugging.

ServerLogger

Intercepts gRPC server calls and logs them for debugging.

Module Contents

class ni_grpc_extensions.loggers.ClientLogger[source]

Bases: grpc.UnaryUnaryClientInterceptor, grpc.UnaryStreamClientInterceptor, grpc.StreamUnaryClientInterceptor, grpc.StreamStreamClientInterceptor

Intercepts gRPC client calls and logs them for debugging.

classmethod is_enabled()[source]

Indicates whether gRPC client call logging is enabled for the current log level.

Return type:

bool

intercept_unary_unary(continuation, client_call_details, request)[source]

Intercept and log a unary call.

Parameters:
Return type:

grpc._CallFuture[grpc._TResponse]

intercept_unary_stream(continuation, client_call_details, request)[source]

Intercept and log a server-streaming call.

Parameters:
Return type:

grpc._CallIterator[grpc._TResponse]

intercept_stream_unary(continuation, client_call_details, request_iterator)[source]

Intercept and log a client-streaming call.

Parameters:
Return type:

grpc._CallFuture[grpc._TResponse]

intercept_stream_stream(continuation, client_call_details, request_iterator)[source]

Intercept and log a bidirectional streaming call.

Parameters:
Return type:

grpc._CallIterator[grpc._TResponse]

class ni_grpc_extensions.loggers.ServerLogger[source]

Bases: grpc.ServerInterceptor

Intercepts gRPC server calls and logs them for debugging.

classmethod is_enabled()[source]

Indicates whether gRPC client call logging is enabled for the current log level.

Return type:

bool

intercept_service(continuation, handler_call_details)[source]

Intercept and log a server call.

Parameters:
Return type:

grpc.RpcMethodHandler[grpc._TRequest, grpc._TResponse] | None