From 7c46099b98bc23e373d78c3ff9739a6a26deb78a Mon Sep 17 00:00:00 2001 From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> Date: Mon, 15 Mar 2021 02:10:37 +0300 Subject: Adds Logging To Helpers Adds logging to the CORS setup, user, and discord helpers. Log statements have been setup in a way to maximize information for local development and prod debugging, while minimizing average load on the prod version. Signed-off-by: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> --- backend/discord.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'backend/discord.py') diff --git a/backend/discord.py b/backend/discord.py index 8cb602c..5a4e0fb 100644 --- a/backend/discord.py +++ b/backend/discord.py @@ -1,4 +1,6 @@ """Various utilities for working with the Discord API.""" +import logging + import httpx from backend.constants import ( @@ -7,8 +9,11 @@ from backend.constants import ( API_BASE_URL = "https://discord.com/api/v8" +logger = logging.getLogger(__name__) + async def fetch_bearer_token(code: str, redirect: str, *, refresh: bool) -> dict: + logger.debug(f"Fetching bearer token with code: {code}") async with httpx.AsyncClient() as client: data = { "client_id": OAUTH2_CLIENT_ID, -- cgit v1.2.3