Fix audit log timezone to UTC+8
Deploy Dashboard / deploy (push) Successful in 25s

This commit is contained in:
Gan, Jimmy
2026-02-22 12:42:21 +08:00
parent eb3391cec4
commit 13eec52cc4
+4 -1
View File
@@ -13,8 +13,11 @@ import httpx
import logging
import time
import jwt
from datetime import datetime, timezone, timedelta
from config import TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, CORS_ORIGINS, SECRET_KEY, ALGORITHM, VOLUME_ROOT
_tz_cst = timezone(timedelta(hours=8))
limiter = Limiter(key_func=get_remote_address)
app = FastAPI(title="NAS Dashboard")
app.state.limiter = limiter
@@ -67,7 +70,7 @@ async def audit_log(request: Request, call_next):
pass
_audit_logger.info(
"%s %s %s %s %s %d %dms",
time.strftime("%Y-%m-%dT%H:%M:%S"), request.client.host, user,
datetime.now(_tz_cst).strftime("%Y-%m-%dT%H:%M:%S"), request.client.host, user,
request.method, request.url.path, response.status_code, duration,
)
return response