瀏覽代碼

调整

d1
H Vs 3 週之前
父節點
當前提交
df6ee1ba6d
共有 2 個文件被更改,包括 28 次插入1 次删除
  1. +22
    -0
      common/log.py
  2. +6
    -1
      tasks.py

+ 22
- 0
common/log.py 查看文件

@@ -172,5 +172,27 @@ def configure_fastapi_logging():
_reset_logger(fastapi_logger)
fastapi_logger.setLevel(logging.INFO)

# Celery 日志配置
def configure_celery_logging():
"""配置 Celery 的日志记录"""
celery_logger = logging.getLogger("celery")
_reset_logger(celery_logger)
celery_logger.setLevel(logging.INFO)

# Celery RedBeat 日志配置
def configure_redbeat_logging():
"""配置 Celery RedBeat 的日志记录"""
redbeat_logger = logging.getLogger("redbeat")
_reset_logger(redbeat_logger)
redbeat_logger.setLevel(logging.INFO)


# 配置 FastAPI 日志
configure_fastapi_logging()

# 配置 Celery 日志
configure_celery_logging()


# 配置 Redbeat 日志
configure_redbeat_logging()

+ 6
- 1
tasks.py 查看文件

@@ -230,7 +230,12 @@ def scheduled_task_add_contacts_from_chatrooms(self, redis_config, kafka_config,
chatroom_member=await gewe_service.get_group_members_from_cache_async(wxid, chatroom_id)
chatroom_nickname = chatroom.get('nickName')
chatroom_owner_wxid = chatroom_member.get('chatroomOwner', None)
admin_wxids = chatroom_member.get('adminWxid', [])
admin_wxids = chatroom_member.get('adminWxid', [])

admin_wxids = chatroom_member.get('adminWxid')
if admin_wxids is None:
admin_wxids = [] # 如果 admin_wxids 是 None,将其初始化为空列表
logger.info(f'{chatroom_nickname} 的群主是 {chatroom_owner_wxid},管理员是{admin_wxids}')
contact_wxids_set = set(contact_wxids)
# for admin_wxid in admin_wxids:


Loading…
取消
儲存