Fix the IP address in the request log (#959)

This commit is contained in:
曾果
2025-12-15 10:07:43 +08:00
committed by GitHub
parent 0c5956f828
commit 6b4fd93e5f

View File

@@ -86,7 +86,7 @@ class OperaLogMiddleware(BaseHTTPMiddleware):
log.debug(f'接口摘要:[{summary}]')
log.debug(f'请求地址:[{ctx.ip}]')
log.debug(f'请求参数:{args}')
log.info(f'{request.client.host: <15} | {request.method: <8} | {code!s: <6} | {path} | {elapsed:.3f}ms')
log.info(f'{ctx.ip: <15} | {request.method: <8} | {code!s: <6} | {path} | {elapsed:.3f}ms')
if request.method != 'OPTIONS':
log.debug('<-- 请求结束')