Fix log init

This commit is contained in:
Changhua
2023-04-04 12:51:14 +08:00
parent 891cada955
commit 057ccac7aa
2 changed files with 6 additions and 4 deletions

View File

@@ -2,8 +2,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import signal import signal
from wcferry import Wcf from wcferry import Wcf
from configuration import Config
from robot import Robot from robot import Robot
@@ -23,6 +25,7 @@ def weather_report(robot: Robot) -> None:
def main(): def main():
config = Config()
wcf = Wcf(debug=True) wcf = Wcf(debug=True)
def handler(sig, frame): def handler(sig, frame):
@@ -31,7 +34,7 @@ def main():
signal.signal(signal.SIGINT, handler) signal.signal(signal.SIGINT, handler)
robot = Robot(wcf) robot = Robot(config, wcf)
robot.LOG.info("正在启动机器人···") robot.LOG.info("正在启动机器人···")
# 机器人启动发送测试消息 # 机器人启动发送测试消息

View File

@@ -5,7 +5,6 @@ import re
import time import time
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import uvicorn
from wcferry import Wcf from wcferry import Wcf
from configuration import Config from configuration import Config
@@ -19,9 +18,9 @@ class Robot(Job):
"""个性化自己的机器人 """个性化自己的机器人
""" """
def __init__(self, wcf: Wcf) -> None: def __init__(self, config: Config, wcf: Wcf) -> None:
self.wcf = wcf self.wcf = wcf
self.config = Config() self.config = config
self.LOG = logging.getLogger("Robot") self.LOG = logging.getLogger("Robot")
self.wxid = self.wcf.get_self_wxid() self.wxid = self.wcf.get_self_wxid()
self.allContacts = self.getAllContacts() self.allContacts = self.getAllContacts()