From ab942b6622b2191706a747d074ea2c4e9a7b1b04 Mon Sep 17 00:00:00 2001 From: tijsziere <39266480+tijsziere@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:40:23 +0200 Subject: [PATCH] fix main --- main.py | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/main.py b/main.py index 648b2e7..a99cbf3 100644 --- a/main.py +++ b/main.py @@ -4,34 +4,13 @@ import requests import os from dotenv import load_dotenv +from utils.logger import logger from routes import routes121, routesEspo, routesGeneric, routesKobo # 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) -exporter = AzureMonitorLogExporter( - connection_string=os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"] -) -logger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter)) - -# Attach LoggingHandler to root logger -handler = LoggingHandler() -logging.getLogger().addHandler(handler) -logging.getLogger().setLevel(logging.NOTSET) -logger = logging.getLogger(__name__) - -# Silence noisy loggers -logging.getLogger("requests").setLevel(logging.WARNING) -logging.getLogger("urllib3").setLevel(logging.WARNING) -logging.getLogger("azure").setLevel(logging.WARNING) -logging.getLogger("requests_oauthlib").setLevel(logging.WARNING) -logging.getLogger("asyncio").setLevel(logging.WARNING) -logging.getLogger("opentelemetry").setLevel(logging.ERROR) - # initialize FastAPI app = FastAPI( title="kobo-connect", @@ -46,16 +25,6 @@ }, ) -# initialize CosmosDB -client_ = cosmos_client.CosmosClient( - os.getenv("COSMOS_URL"), - {"masterKey": os.getenv("COSMOS_KEY")}, - user_agent="kobo-connect", - user_agent_overwrite=True, -) -cosmos_db = client_.get_database_client("kobo-connect") -cosmos_container_client = cosmos_db.get_container_client("kobo-submissions") - @app.get("/", include_in_schema=False) async def docs_redirect():