From c643961c3246253207179587c1e864a0e56c119f Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Sun, 22 Dec 2024 21:11:18 +0000 Subject: [PATCH 1/2] set log level to INFO --- src/database.py | 2 +- src/main.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/database.py b/src/database.py index 472810b..bb77821 100644 --- a/src/database.py +++ b/src/database.py @@ -64,7 +64,7 @@ def get_connection(): """ db_url = os.getenv("DB_URL") if db_url and db_url.find("postgresql") != -1: - return DatabaseConnection(url=db_url) + return DatabaseConnection(url=db_url, echo=False) else: return DummyDBConnection() diff --git a/src/main.py b/src/main.py index 3d0847c..9d3408b 100644 --- a/src/main.py +++ b/src/main.py @@ -4,6 +4,7 @@ import time from datetime import timedelta +import logging import sentry_sdk import structlog from fastapi import FastAPI, Request @@ -22,6 +23,8 @@ # flake8: noqa E501 +logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) + structlog.configure( processors=[ structlog.processors.EventRenamer("message", replace_by="_event"), From 2025c1f4de62296dc7b26ae65d1db531e21fd064 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Sun, 22 Dec 2024 21:12:43 +0000 Subject: [PATCH 2/2] isort --- src/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 9d3408b..1ff6e04 100644 --- a/src/main.py +++ b/src/main.py @@ -1,10 +1,10 @@ """ Main FastAPI app """ +import logging import os import time from datetime import timedelta -import logging import sentry_sdk import structlog from fastapi import FastAPI, Request