This commit is contained in:
0Xiao0
2025-02-06 10:39:47 +08:00
parent 6ed4d1b2e3
commit 7faa37e22c

View File

@ -14,10 +14,7 @@ class Main():
def init_log_handlers(self):
with open(".env.yaml", "r") as file:
config = yaml.safe_load(file)
if config["log"] is None:
return
if config["log"]["handlers"] is None:
return
try:
log_handler_confg = config["log"]["handlers"]
log_handlers = [logging.StreamHandler()]
for handler_config in log_handler_confg:
@ -34,6 +31,8 @@ class Main():
))
logging.basicConfig(level=logging.DEBUG, handlers=log_handlers)
logging.info("logging init finish")
except KeyError:
return
def __init__(self) -> None:
self.init_log_handlers()