2.15 排查基础信息

This commit is contained in:
zy123 2025-02-15 13:24:45 +08:00
parent 985a487d5b
commit a0e1add4f7
3 changed files with 6 additions and 4 deletions

View File

@ -52,6 +52,7 @@ def qianwen_long(file_id, user_query, max_retries=2, backoff_factor=1.0, need_ex
- backoff_factor: 指数退避的基础等待时间默认 1.0
- need_extra: 是否需要返回额外数据默认 False
"""
logger.info("zy123")
client = OpenAI(
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"

View File

@ -27,7 +27,7 @@ class CSTFormatter(logging.Formatter):
def create_logger_main(log_name, log_dir='/flask_project/flask_app/static/output', max_bytes=10*1024*1024, backup_count=5):
"""
根据名称创建全局日志记录器
根据名称创建全局日志记录器并将日志写入指定的 .txt 文件中
"""
os.makedirs(log_dir, exist_ok=True) # 确保日志目录存在
@ -35,9 +35,10 @@ def create_logger_main(log_name, log_dir='/flask_project/flask_app/static/output
if not logger.hasHandlers(): # 防止重复添加处理器
logger.setLevel(logging.INFO)
# 创建文件处理器
# 将文件名设置为 model_log.txt如果 log_name 为 "model_log"
log_file_path = os.path.join(log_dir, f'{log_name}.txt')
file_handler = RotatingFileHandler(
os.path.join(log_dir, f'{log_name}.log'),
log_file_path,
maxBytes=max_bytes,
backupCount=backup_count,
encoding='utf-8'

View File

@ -16,7 +16,7 @@ from flask_app.routes.test_preprocess import test_process_bp
def create_app():
# 创建全局日志记录器
app = Flask(__name__)
app.global_logger = create_logger_main('global_log') # 全局日志记录器
app.global_logger = create_logger_main('model_log') # 全局日志记录器
# 注册蓝图
app.register_blueprint(get_deviation_bp)
app.register_blueprint(little_zbparse_bp)