chore: baseline V8.10.0-dev.1 with v8_workflows type-mapping fix and trade-pro spec
- SiteForge Enterprise V8.10.0-dev.1 upstream source (210 tests) - Fix: v8_workflows._mapped_input now reads both 类型/分类 columns so WXR imports keep post/product types instead of collapsing to page - Docs: trade-pro theme port spec (R3) and implementation plan Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Request correlation without logging URLs, cookies, bodies or credentials."""
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
import uuid
|
||||
from starlette.middleware.base import BaseHTTPMiddleware
|
||||
|
||||
log=logging.getLogger('siteforge.request')
|
||||
log.setLevel(logging.INFO)
|
||||
if not log.handlers:log.addHandler(logging.StreamHandler())
|
||||
|
||||
class TraceMiddleware(BaseHTTPMiddleware):
|
||||
async def dispatch(self,request,call_next):
|
||||
rid=uuid.uuid4().hex[:16]
|
||||
request.state.request_id=rid
|
||||
started=time.monotonic()
|
||||
try:
|
||||
response=await call_next(request)
|
||||
except Exception:
|
||||
log.error(json.dumps({'event':'http_request','id':rid,'method':request.method,
|
||||
'status':500,'duration_ms':round((time.monotonic()-started)*1000)}))
|
||||
raise
|
||||
response.headers['X-Request-ID']=rid
|
||||
log.info(json.dumps({'event':'http_request','id':rid,'method':request.method,
|
||||
'status':response.status_code,'duration_ms':round((time.monotonic()-started)*1000)}))
|
||||
return response
|
||||
Reference in New Issue
Block a user