fix http logs did not show org info (#3701)
This commit is contained in:
@@ -60,14 +60,18 @@ async def log_raw_request_middleware(request: Request, call_next: Callable[[Requ
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
url_path = request.url.path
|
||||||
|
http_method = request.method
|
||||||
sanitized_headers = _sanitize_headers(dict(request.headers))
|
sanitized_headers = _sanitize_headers(dict(request.headers))
|
||||||
body_text = _sanitize_body(request, body_bytes, request.headers.get("content-type"))
|
body_text = _sanitize_body(request, body_bytes, request.headers.get("content-type"))
|
||||||
|
|
||||||
LOG.info(
|
try:
|
||||||
"api.raw_request",
|
return await call_next(request)
|
||||||
method=request.method,
|
finally:
|
||||||
path=request.url.path,
|
LOG.info(
|
||||||
headers=sanitized_headers,
|
"api.raw_request",
|
||||||
body=body_text,
|
method=http_method,
|
||||||
)
|
path=url_path,
|
||||||
return await call_next(request)
|
headers=sanitized_headers,
|
||||||
|
body=body_text,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user