diff --git a/.env.example b/.env.example index 5b943f1..21ad988 100644 --- a/.env.example +++ b/.env.example @@ -21,3 +21,6 @@ REDIS_HOST='redis_for_netflix' # Redis 端口 REDIS_PORT=6379 + +# 是否启用 Debug 模式 1:启用 0:不启用 +DEBUG=0 diff --git a/netflix.py b/netflix.py index 3645f71..4388b04 100644 --- a/netflix.py +++ b/netflix.py @@ -231,7 +231,7 @@ def today_(): def __logger_setting(self) -> None: logger.remove() - level = 'DEBUG' if self.args.debug else 'INFO' + level = 'DEBUG' if self.args.debug or int(os.getenv('DEBUG', 0)) else 'INFO' format = '[{time:YYYY-MM-DD HH:mm:ss.SSS}] {level: <8} | {process.id}:{name}:{function}:{line} - {message}' logger.add('logs/{time:YYYY-MM-DD}.log', level=level, format=format, encoding='utf-8')