INNER CODE UNIT · Python

_is_async_request

bobbui/json-logging-python · json_logging/framework/connexion/__init__.py:61

def _is_async_request(request):
    return _AsyncApp is not None and isinstance(request, _StarletteRequest)


class ConnexionAppRequestInstrumentationConfigurator(BaseAppRequestInstrumentationConfigurator):
    def config(self, app, request_response_dto_class, exclude_url_patterns=[]):
        if not is_connexion_present():
            raise RuntimeError("connexion is not available in system runtime")
        if _AsyncApp is not None and isinstance(app, _AsyncApp):
            # Disable standard access logging, the middleware logs every request
            logging.getLogger('uvicorn.access').disabled = True

            # noinspection PyAttributeOutsideInit
            self.request_logger = logging.getLogger('connexion-request-logger')

            # Added before the ExceptionMiddleware, so error responses produced by exception handlers are logged too
            app.add_middleware(JSONLoggingConnexionASGIMiddleware, position=_MiddlewarePosition.BEFORE_EXCEPTION,
                               request_response_dto_class=request_response_dto_class,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…