15 lines
467 B
Python
15 lines
467 B
Python
"""
|
|
中间件:用于调试和日志记录
|
|
"""
|
|
from flask import request
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def log_request_info():
|
|
"""记录请求信息(用于调试)"""
|
|
if request.path.startswith('/api/'):
|
|
auth_header = request.headers.get('Authorization', 'None')
|
|
logger.info(f"Request: {request.method} {request.path}")
|
|
logger.info(f"Authorization: {auth_header[:50] if auth_header != 'None' else 'None'}")
|