From 14069059052b80b48890d06fde39a61583286d71 Mon Sep 17 00:00:00 2001 From: nina-hu Date: Wed, 10 Jun 2026 23:39:00 -0700 Subject: [PATCH] Lazy evaluate debug log in pass-through endpoint (#30177) * Pass through debug lazy logging * fix(proxy): convert remaining eager pass-through debug logs to lazy formatting --- .../pass_through_endpoints.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index d2b848e3c33..04c9256fdf8 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -174,9 +174,7 @@ async def chat_completion_pass_through_endpoint( # noqa: PLR0915 data["adapter_id"] = adapter_id - verbose_proxy_logger.debug( - "Request received by LiteLLM:\n{}".format(json.dumps(data, indent=4)), - ) + verbose_proxy_logger.debug("Request received by LiteLLM:\n%s", data) data["model"] = ( general_settings.get("completion_model", None) # server default or user_model # model name passed via cli args @@ -298,7 +296,7 @@ async def chat_completion_pass_through_endpoint( # noqa: PLR0915 ) ) - verbose_proxy_logger.debug("\nResponse from Litellm:\n{}".format(response)) + verbose_proxy_logger.debug("\nResponse from Litellm:\n%s", response) return response except Exception as e: await proxy_logging_obj.post_call_failure_hook( @@ -811,9 +809,10 @@ async def pass_through_request( # noqa: PLR0915 else: _parsed_body = await _read_request_body(request) verbose_proxy_logger.debug( - "Pass through endpoint sending request to \nURL {}\nheaders: {}\nbody: {}\n".format( - url, headers, _parsed_body - ) + "Pass through endpoint sending request to \nURL %s\nheaders: %s\nbody: %s\n", + url, + headers, + _parsed_body, ) ### COLLECT GUARDRAILS FOR PASSTHROUGH ENDPOINT ###