Files

9 lines
270 B
Python
Raw Permalink Normal View History

2026-09-20 19:45:36 +08:00
import time
async def log_middleware(request, call_next):
start_time = time.time()
response = await call_next(request)
end_time = time.time()
cost = end_time - start_time
print(f'{request.method} {request.url.path} cost={cost}')
return response