mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 00:23:53 +08:00
update:初始化上传
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def setup_logging(log_dir='tmp'):
|
||||
"""配置全局日志"""
|
||||
os.makedirs(log_dir, exist_ok=True)
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
handlers=[
|
||||
logging.StreamHandler(sys.stdout),
|
||||
logging.FileHandler(os.path.join(log_dir, "server.log"))
|
||||
],
|
||||
force=True
|
||||
)
|
||||
return logging.getLogger(__name__)
|
||||
@@ -0,0 +1,10 @@
|
||||
import argparse
|
||||
from core.utils.util import read_config
|
||||
|
||||
|
||||
def load_config():
|
||||
"""加载配置文件"""
|
||||
parser = argparse.ArgumentParser(description="Server configuration")
|
||||
parser.add_argument("--config_path", type=str, default="config.yaml")
|
||||
args = parser.parse_args()
|
||||
return read_config(args.config_path)
|
||||
Reference in New Issue
Block a user