From 33409edde26b852d6dce2b592887b77ec8bcf470 Mon Sep 17 00:00:00 2001 From: Jacopo Margutti Date: Thu, 22 Aug 2024 15:18:22 +0200 Subject: [PATCH] silence noisy logs --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index daa6cea..ad3fae0 100644 --- a/main.py +++ b/main.py @@ -32,6 +32,10 @@ from opentelemetry.sdk._logs.export import BatchLogRecordProcessor from azure.monitor.opentelemetry.exporter import AzureMonitorLogExporter +# load environment variables +load_dotenv() +port = os.environ["PORT"] + # Set up logs export to Azure Application Insights logger_provider = LoggerProvider() set_logger_provider(logger_provider) @@ -51,10 +55,8 @@ logging.getLogger("urllib3").setLevel(logging.WARNING) logging.getLogger("azure").setLevel(logging.WARNING) logging.getLogger("requests_oauthlib").setLevel(logging.WARNING) - -# load environment variables -load_dotenv() -port = os.environ["PORT"] +logging.getLogger("asyncio").setLevel(logging.WARNING) +logging.getLogger("opentelemetry").setLevel(logging.ERROR) # initialize FastAPI app = FastAPI( @@ -538,7 +540,7 @@ class system(str, Enum): @app.post("/create-kobo-headers") async def create_kobo_headers( - request: Request, + json_data: dict, system: system, koboassetId: str, hookId: str = None, @@ -548,7 +550,6 @@ async def create_kobo_headers( ***NB: if you want to duplicate an endpoint, please also use the Hook ID query param*** """ - json_data = await request.json() if json_data is None: raise HTTPException(status_code=400, detail="JSON data is required")