Log response content

This commit is contained in:
Ivan Habunek 2024-04-24 14:11:22 +02:00
parent 3d03658850
commit 5aa323e3e5
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D

View File

@ -137,14 +137,15 @@ logger = logging.getLogger(__name__)
def log_request(request: httpx.Request):
logger.debug(f"--> {request.method} {request.url}")
if request.content:
for line in request.content.splitlines():
logger.debug(line)
logger.debug(f"--> {request.content}")
def log_response(response: httpx.Response, duration: float):
request = response.request
duration_ms = int(1000 * duration)
logger.debug(f"<-- {request.method} {request.url} HTTP {response.status_code} {duration_ms}ms")
if response.content:
logger.debug(f"<-- {response.content}")
def gql_post(query: str):