Commit e0f3e9f4 by baiquan

refactor(log): 调整日志级别并优化日志输出

- 将代理验证成功的日志级别从 info 降低到 debug
- 将没有任务的日志级别从 error 降低到 debug
- 优化大字符串日志的输出格式,限制长度
parent 84632006
...@@ -263,7 +263,8 @@ async def uploadImageAndVideo(task: dict = None): ...@@ -263,7 +263,8 @@ async def uploadImageAndVideo(task: dict = None):
"error_msg": error_msg "error_msg": error_msg
# "type": 2 # "type": 2
} }
logger.info(json.dumps(callback_data)) callback_str = json.dumps(callback_data)
logger.info(f"{callback_str[:1000]}......{callback_str[-1000:]}")
await callback_task(callback_data, TaskType.DOUDIAN_UPLOAD_IMAGE_AND_VIDEO) await callback_task(callback_data, TaskType.DOUDIAN_UPLOAD_IMAGE_AND_VIDEO)
async def run_in_executor(func, *args): async def run_in_executor(func, *args):
......
...@@ -191,7 +191,7 @@ async def run(task_type): ...@@ -191,7 +191,7 @@ async def run(task_type):
if type(tasks) == dict: if type(tasks) == dict:
tasks = [tasks] tasks = [tasks]
if not tasks: if not tasks:
logger.error('没有任务') logger.debug('没有任务')
return return
# 使用线程池处理所有任务 # 使用线程池处理所有任务
......
...@@ -26,7 +26,7 @@ def check_proxy(proxy_url): ...@@ -26,7 +26,7 @@ def check_proxy(proxy_url):
except Exception as e: except Exception as e:
raise ProxyConnectionError(f"{addr}-->代理验证失败-->{str(e)}") raise ProxyConnectionError(f"{addr}-->代理验证失败-->{str(e)}")
if test_res.get('origin', "") == addr: if test_res.get('origin', "") == addr:
logger.info(f"{addr}-->代理验证成功") logger.debug(f"{addr}-->代理验证成功")
return proxies return proxies
else: else:
raise ProxyConnectionError(f"{addr}-->代理验证失败") raise ProxyConnectionError(f"{addr}-->代理验证失败")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment