Spaces:
Running
Running
Update backend/server.py
Browse files- backend/server.py +2 -1
backend/server.py
CHANGED
|
@@ -8,6 +8,7 @@ from dataclasses import dataclass
|
|
| 8 |
from typing import Any, Dict, List, Optional
|
| 9 |
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, Request
|
| 10 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 11 |
|
| 12 |
SERVER_MAX_WORKERS = int(os.environ.get('SERVER_MAX_WORKERS', '15'))
|
| 13 |
JOB_TTL_SEC = int(os.environ.get('JOB_TTL_SEC', '3600'))
|
|
@@ -797,7 +798,7 @@ async def _tp_access_log(request: Request, call_next):
|
|
| 797 |
port = client.port if client else 0
|
| 798 |
ver = request.scope.get("http_version") or "1.1"
|
| 799 |
phrase = HTTPStatus(resp.status_code).phrase
|
| 800 |
-
print(f'{host}:{port} - "{request.method} {path} HTTP/{ver}" {resp.status_code} {phrase}', flush=True)
|
| 801 |
except Exception:
|
| 802 |
pass
|
| 803 |
return resp
|
|
|
|
| 8 |
from typing import Any, Dict, List, Optional
|
| 9 |
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, Request
|
| 10 |
from fastapi.middleware.cors import CORSMiddleware
|
| 11 |
+
from datetime import datetime
|
| 12 |
|
| 13 |
SERVER_MAX_WORKERS = int(os.environ.get('SERVER_MAX_WORKERS', '15'))
|
| 14 |
JOB_TTL_SEC = int(os.environ.get('JOB_TTL_SEC', '3600'))
|
|
|
|
| 798 |
port = client.port if client else 0
|
| 799 |
ver = request.scope.get("http_version") or "1.1"
|
| 800 |
phrase = HTTPStatus(resp.status_code).phrase
|
| 801 |
+
print(f'[{datetime.now():%Y-%m-%d %H:%M:%S}] {host}:{port} - "{request.method} {path} HTTP/{ver}" {resp.status_code} {phrase}', flush=True)
|
| 802 |
except Exception:
|
| 803 |
pass
|
| 804 |
return resp
|