prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add logging for OAuth flows
  We merged the basic implementation in #414, but neglected to include any additional logging around the new flows/logic.
  
  Some ideas of what we should log:
  
  - [x] The `OAUTH_CLIENT_NAME` used
  - [x] The `redirect_uri` sent to the authorization server with the `authorize_redirect` request
  - [x] If an access token fails to be authorized
  
  </issue>
  <code>
  [start of benefits/oauth/views.py]
  1 from django.shortcuts import redirect
  2 from django.urls import reverse
  3 
  4 from authlib.integrations.django_client import OAuth
  5 
  6 from benefits.core import session
  7 from benefits.settings import OAUTH_CLIENT_NAME
  8 
  9 
  10 if OAUTH_CLIENT_NAME:
  11     _oauth = OAuth()
  12     _oauth.register(OAUTH_CLIENT_NAME)
  13     oauth_client = _oauth.create_client(OAUTH_CLIENT_NAME)
  14 
  15 
  16 ROUTE_AUTH = "oauth:authorize"
  17 ROUTE_START = "eligibility:start"
  18 ROUTE_CONFIRM = "eligibility:confirm"
  19 
  20 
  21 def login(request):
  22     if not oauth_client:
  23         raise Exception("No OAuth client")
  24 
  25     route = reverse(ROUTE_AUTH)
  26     redirect_uri = request.build_absolute_uri(route)
  27 
  28     return oauth_client.authorize_redirect(request, redirect_uri)
  29 
  30 
  31 def authorize(request):
  32     if not oauth_client:
  33         raise Exception("No OAuth client")
  34 
  35     token = oauth_client.authorize_access_token(request)
  36 
  37     if token is None:
  38         return redirect(ROUTE_START)
  39     else:
  40         # we are intentionally not storing anything about the user, including their token
  41         session.update(request, auth=True)
  42         return redirect(ROUTE_CONFIRM)
  43
  [end of benefits/oauth/views.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/benefits/oauth/views.py b/benefits/oauth/views.py
  --- a/benefits/oauth/views.py
  +++ b/benefits/oauth/views.py
  @@ -1,3 +1,5 @@
  +import logging
  +
   from django.shortcuts import redirect
   from django.urls import reverse
   
  @@ -7,7 +9,12 @@
   from benefits.settings import OAUTH_CLIENT_NAME
   
   
  +logger = logging.getLogger(__name__)
  +
  +
   if OAUTH_CLIENT_NAME:
  +    logger.debug(f"Using OAuth client configuration: {OAUTH_CLIENT_NAME}")
  +
       _oauth = OAuth()
       _oauth.register(OAUTH_CLIENT_NAME)
       oauth_client = _oauth.create_client(OAUTH_CLIENT_NAME)
  @@ -25,6 +32,8 @@
       route = reverse(ROUTE_AUTH)
       redirect_uri = request.build_absolute_uri(route)
   
  +    logger.debug(f"OAuth authorize_redirect with redirect_uri: {redirect_uri}")
  +
       return oauth_client.authorize_redirect(request, redirect_uri)
   
   
  @@ -32,11 +41,14 @@
       if not oauth_client:
           raise Exception("No OAuth client")
   
  +    logger.debug("Attempting to authorize OAuth access token")
       token = oauth_client.authorize_access_token(request)
   
       if token is None:
  +        logger.warning("Could not authorize OAuth access token")
           return redirect(ROUTE_START)
       else:
           # we are intentionally not storing anything about the user, including their token
  +        logger.debug("OAuth access token authorized")
           session.update(request, auth=True)
           return redirect(ROUTE_CONFIRM)
  
verification_info: {"golden_diff": "diff --git a/benefits/oauth/views.py b/benefits/oauth/views.py\n--- a/benefits/oauth/views.py\n+++ b/benefits/oauth/views.py\n@@ -1,3 +1,5 @@\n+import logging\n+\n from django.shortcuts import redirect\n from django.urls import reverse\n \n@@ -7,7 +9,12 @@\n from benefits.settings import OAUTH_CLIENT_NAME\n \n \n+logger = logging.getLogger(__name__)\n+\n+\n if OAUTH_CLIENT_NAME:\n+    logger.debug(f\"Using OAuth client configuration: {OAUTH_CLIENT_NAME}\")\n+\n     _oauth = OAuth()\n     _oauth.register(OAUTH_CLIENT_NAME)\n     oauth_client = _oauth.create_client(OAUTH_CLIENT_NAME)\n@@ -25,6 +32,8 @@\n     route = reverse(ROUTE_AUTH)\n     redirect_uri = request.build_absolute_uri(route)\n \n+    logger.debug(f\"OAuth authorize_redirect with redirect_uri: {redirect_uri}\")\n+\n     return oauth_client.authorize_redirect(request, redirect_uri)\n \n \n@@ -32,11 +41,14 @@\n     if not oauth_client:\n         raise Exception(\"No OAuth client\")\n \n+    logger.debug(\"Attempting to authorize OAuth access token\")\n     token = oauth_client.authorize_access_token(request)\n \n     if token is None:\n+        logger.warning(\"Could not authorize OAuth access token\")\n         return redirect(ROUTE_START)\n     else:\n         # we are intentionally not storing anything about the user, including their token\n+        logger.debug(\"OAuth access token authorized\")\n         session.update(request, auth=True)\n         return redirect(ROUTE_CONFIRM)\n", "issue": "Add logging for OAuth flows\nWe merged the basic implementation in #414, but neglected to include any additional logging around the new flows/logic.\r\n\r\nSome ideas of what we should log:\r\n\r\n- [x] The `OAUTH_CLIENT_NAME` used\r\n- [x] The `redirect_uri` sent to the authorization server with the `authorize_redirect` request\r\n- [x] If an access token fails to be authorized\n", "before_files": [{"content": "from django.shortcuts import redirect\nfrom django.urls import reverse\n\nfrom authlib.integrations.django_client import OAuth\n\nfrom benefits.core import session\nfrom benefits.settings import OAUTH_CLIENT_NAME\n\n\nif OAUTH_CLIENT_NAME:\n    _oauth = OAuth()\n    _oauth.register(OAUTH_CLIENT_NAME)\n    oauth_client = _oauth.create_client(OAUTH_CLIENT_NAME)\n\n\nROUTE_AUTH = \"oauth:authorize\"\nROUTE_START = \"eligibility:start\"\nROUTE_CONFIRM = \"eligibility:confirm\"\n\n\ndef login(request):\n    if not oauth_client:\n        raise Exception(\"No OAuth client\")\n\n    route = reverse(ROUTE_AUTH)\n    redirect_uri = request.build_absolute_uri(route)\n\n    return oauth_client.authorize_redirect(request, redirect_uri)\n\n\ndef authorize(request):\n    if not oauth_client:\n        raise Exception(\"No OAuth client\")\n\n    token = oauth_client.authorize_access_token(request)\n\n    if token is None:\n        return redirect(ROUTE_START)\n    else:\n        # we are intentionally not storing anything about the user, including their token\n        session.update(request, auth=True)\n        return redirect(ROUTE_CONFIRM)\n", "path": "benefits/oauth/views.py"}]}