Use environ variable MHYY_LOGLEVEL to set the level of the log
Some checks are pending
SyncMirror / sync (push) Waiting to run
Some checks are pending
SyncMirror / sync (push) Waiting to run
This commit is contained in:
parent
002f8b0842
commit
19efa09b48
10
main.py
10
main.py
|
@ -8,10 +8,18 @@ import time
|
||||||
import yaml
|
import yaml
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
if os.environ.get("MHYY_LOGLEVEL").upper() == "DEBUG":
|
||||||
|
loglevel = logging.DEBUG
|
||||||
|
elif os.environ.get("MHYY_LOGLEVEL").upper() == "WARNING":
|
||||||
|
loglevel = logging.WARNING
|
||||||
|
elif os.environ.get("MHYY_LOGLEVEL").upper() == "ERROR":
|
||||||
|
loglevel = logging.ERROR
|
||||||
|
else:
|
||||||
|
loglevel = logging.INFO
|
||||||
|
|
||||||
# 设置日志配置
|
# 设置日志配置
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=os.environ.get("MHYY_LOGLEVEL") if os.environ.get("MHYY_LOGLEVEL") else logging.INFO,
|
level=loglevel,
|
||||||
format="%(asctime)s [%(levelname)s]: %(message)s",
|
format="%(asctime)s [%(levelname)s]: %(message)s",
|
||||||
datefmt="%Y-%m-%d %H:%M:%S",
|
datefmt="%Y-%m-%d %H:%M:%S",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user