INNER CODE UNIT · Python
config
bobbui/json-logging-python · json_logging/framework/connexion/__init__.py:66
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,
exclude_url_patterns=exclude_url_patterns)
return
if _flask is None:
raise RuntimeError("app is not a valid connexion.AsyncApp instance, and flask is not installed")