This commit is contained in:
0Xiao0
2025-02-06 09:53:47 +08:00
parent d6d968a4a0
commit d2ac2e716d

10
main.py
View File

@ -11,10 +11,13 @@ import yaml
@singleton
class Main():
def __init__(self) -> None:
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
log_handler_confg = config["log"]["handlers"]
log_handlers = []
for handler_config in log_handler_confg:
@ -32,6 +35,9 @@ class Main():
logging.basicConfig(level=logging.DEBUG, handlers=log_handlers)
logging.info("logging init finish")
def __init__(self) -> None:
self.init_log_handlers()
def run(self):
logger = logging.getLogger(__name__)
logger.info("jarvis-models start", extra={"version": "0.0.1"})