diff --git a/change_app.py b/change_app.py index ef99561..5183a67 100644 --- a/change_app.py +++ b/change_app.py @@ -32,7 +32,7 @@ logger.setLevel(logging.INFO) # 设置 logger 的级别 now = datetime.now() # 格式化为字符串(例如:2023-10-25 14:30:45) -date_time_str = now.strftime("%Y-%m-%d_%H:%M:%S") +date_time_str = now.strftime("%Y-%m-%d_%H-%M-%S") # 创建文件 handler file_handler = logging.FileHandler(f'/var/log/fuyan/change_app_{date_time_str}.log') @@ -62,6 +62,12 @@ redis_pool = redis.ConnectionPool( max_connections=2000 # 根据实际情况调整 ) +from datetime import datetime +def log_message(msg): + """简单的日志输出函数""" + print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] {msg}") + logger.info(msg) + def get_redis_conn(): """获取 Redis 连接""" return redis.Redis(connection_pool=redis_pool) @@ -818,6 +824,7 @@ def index(): @app.route('/do_change_cloth', methods=['POST']) def do_change_cloth(): + log_message("do_change_cloth called") """从 URL 下载图片""" data = request.json @@ -925,6 +932,7 @@ def queueCall(data): @app.route('/change_cloth', methods=['POST']) def change_cloth(): + log_message("change_cloth_base64 called") """从 URL 下载图片""" data = request.json @@ -958,6 +966,8 @@ def change_cloth(): @app.route('/change_cloth_base64', methods=['POST']) def change_cloth_base64(): + log_message("change_cloth_base64 called") + # 获取参数 data = request.get_json() print(f"change_cloth_base64 input data:{data}")