Files
Wu Clan 2bbbbe764a Update the log output default style (#714)
* Update the log output default style

* Update the log file compression

* fix line

* Add log summary
2025-07-06 14:32:36 +08:00

16 lines
382 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fastapi import Request
from backend.core.conf import settings
def get_request_trace_id(request: Request) -> str:
"""
从请求头中获取追踪 ID
:param request: FastAPI 请求对象
:return:
"""
return request.headers.get(settings.TRACE_ID_REQUEST_HEADER_KEY) or settings.TRACE_ID_LOG_DEFAULT_VALUE