fix log level

This commit is contained in:
jxxghp 2023-08-08 15:40:37 +08:00
parent 406374506f
commit 78fd659e35
4 changed files with 8 additions and 3 deletions

View File

@ -23,6 +23,8 @@ class Settings(BaseSettings):
PORT: int = 3001 PORT: int = 3001
# 是否调试模式 # 是否调试模式
DEBUG: bool = False DEBUG: bool = False
# 是否开发模式
DEV: bool = False
# 配置文件目录 # 配置文件目录
CONFIG_DIR: str = None CONFIG_DIR: str = None
# 超级管理员 # 超级管理员

View File

@ -5,7 +5,10 @@ from app.core.config import settings
# logger # logger
logger = logging.getLogger() logger = logging.getLogger()
logger.setLevel(logging.INFO) if settings.DEBUG:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
# 创建终端输出Handler # 创建终端输出Handler
console_handler = logging.StreamHandler() console_handler = logging.StreamHandler()

View File

@ -29,7 +29,7 @@ App.add_middleware(
# uvicorn服务 # uvicorn服务
Server = uvicorn.Server(Config(App, host=settings.HOST, port=settings.PORT, Server = uvicorn.Server(Config(App, host=settings.HOST, port=settings.PORT,
reload=settings.DEBUG, workers=multiprocessing.cpu_count())) reload=settings.DEV, workers=multiprocessing.cpu_count()))
def init_routers(): def init_routers():

View File

@ -38,7 +38,7 @@ class Scheduler(metaclass=Singleton):
def __init__(self): def __init__(self):
# 调试模式不启动定时服务 # 调试模式不启动定时服务
if settings.DEBUG: if settings.DEV:
return return
# CookieCloud定时同步 # CookieCloud定时同步
if settings.COOKIECLOUD_INTERVAL: if settings.COOKIECLOUD_INTERVAL: