internal 1.0.123__py3-none-any.whl → 1.0.125__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of internal might be problematic. Click here for more details.

@@ -3,6 +3,7 @@ import time
3
3
 
4
4
  from fastapi import FastAPI, Request
5
5
  from starlette.middleware.base import BaseHTTPMiddleware
6
+ from ..const import CORRELATION_ID_HEADER_KEY_NAME
6
7
 
7
8
 
8
9
  class LogRequestMiddleware(BaseHTTPMiddleware):
@@ -14,15 +15,19 @@ class LogRequestMiddleware(BaseHTTPMiddleware):
14
15
  async def dispatch(self, request: Request, call_next):
15
16
  # 记录请求的URL和参数
16
17
  url = request.url.path
18
+ method = request.method
17
19
  headers = request.headers
20
+ request_id = headers.get(CORRELATION_ID_HEADER_KEY_NAME, "")
18
21
  params = dict(request.query_params)
19
22
  body = await request.body()
20
- self.logger.info(f"URL: {url} - Headers: {headers} - Params: {params} - Body: {body}")
23
+ self.logger.info(
24
+ f"[Request id: {request_id}] Method: {method}, URL: {url} - Headers: {headers} - Params: {params} - Body: {body} start processing...")
21
25
 
22
26
  # 记录请求处理时间
23
27
  start_time = time.time()
24
28
  response = await call_next(request)
25
29
  process_time = time.time() - start_time
26
30
 
27
- self.logger.info(f"Completed in {process_time:.4f} seconds")
31
+ self.logger.info(
32
+ f"[Request id: {request_id}] Method: {method}, URL: {url} - Headers: {headers} - Params: {params} - Body: {body}, Completed in {process_time:.4f} seconds")
28
33
  return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: internal
3
- Version: 1.0.123
3
+ Version: 1.0.125
4
4
  Summary:
5
5
  Author: Ray
6
6
  Author-email: ray@cruisys.com
@@ -28,12 +28,12 @@ internal/http/responses.py,sha256=zvU0iRQ9-qxeEZfKmuvTi8lv9DFcaNAsHlQKOTCpVzw,29
28
28
  internal/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  internal/interface/base_interface.py,sha256=3YaVjIgLi_pZpLk5SEIk8WVkuICM8qPavT8rB0MdB5U,1536
30
30
  internal/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- internal/middleware/log_request.py,sha256=s4epUnpU8W-WspfZF4Gn0ovX7pJe2hlb9H0NeddGLyY,909
31
+ internal/middleware/log_request.py,sha256=DrF0WpJNgdzvZUP8UqofS2y4TlJfE0QYKfwgVTiB4xU,1264
32
32
  internal/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  internal/model/base_model.py,sha256=NWjysNOp2MfXvAHGFqaQA_l8ZfTFvJbXQPUPuOXN_2g,5361
34
34
  internal/model/operate.py,sha256=QSM6yXYXpJMwrqkUGEWZLrEBaUgqHwVHY_Fi4S42hKc,3190
35
35
  internal/utils.py,sha256=i6YZdiXsiWnOjRdlJ6afNCGpyMe3Uo9mhm3xlQBy3Ls,2824
36
36
  internal/validator_utils.py,sha256=5ZLcNIgw1hvkYOj1f6gS9AYxe7Y3ufW9FyDxUS7FsMQ,1226
37
- internal-1.0.123.dist-info/METADATA,sha256=JY4AZxEBnkkmT-0o_T6JO4s-vLkla-yZ2dTKuDBAngQ,809
38
- internal-1.0.123.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
39
- internal-1.0.123.dist-info/RECORD,,
37
+ internal-1.0.125.dist-info/METADATA,sha256=Ql9dxl8eHML2hijU2WKjQT-RDVqIi1TWtAPdv6xIP0k,809
38
+ internal-1.0.125.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
39
+ internal-1.0.125.dist-info/RECORD,,