Skip to content

Commit

Permalink
silence noisy logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmargutt committed Aug 22, 2024
1 parent 67d02bd commit 33409ed
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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")

Expand Down

0 comments on commit 33409ed

Please sign in to comment.