Skip to content

Commit

Permalink
debug 模式开关
Browse files Browse the repository at this point in the history
  • Loading branch information
luolongfei committed Jan 12, 2022
1 parent a31aae1 commit 03f22c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ REDIS_HOST='redis_for_netflix'

# Redis 端口
REDIS_PORT=6379

# 是否启用 Debug 模式 1:启用 0:不启用
DEBUG=0
2 changes: 1 addition & 1 deletion netflix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<green>[{time:YYYY-MM-DD HH:mm:ss.SSS}]</green> <b><level>{level: <8}</level></b> | <cyan>{process.id}</cyan>:<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>'

logger.add('logs/{time:YYYY-MM-DD}.log', level=level, format=format, encoding='utf-8')
Expand Down

0 comments on commit 03f22c3

Please sign in to comment.