Could we do something like:
from connectrpc.interceptor import Interceptor
class LoggingInterceptor(Interceptor):
async def intercept(self, method, request, context, next_handler):
response = await next_handler(request, context)
if response.stream:
async for event in response.stream:
if event.event_type == 'LogEvent':
logging.info(event.message)
# (server sends LogEvents when client should print something to console)
return response
client = HelloServiceClient(
base_url="https://api.example.com",
session=session,
interceptors=[LoggingInterceptor()]
)