更新日志输出路径
This commit is contained in:
parent
883ea33876
commit
fc7abf9208
4
.gitignore
vendored
4
.gitignore
vendored
@ -253,7 +253,7 @@ ipython_config.py
|
||||
# Remove previous ipynb_checkpoints
|
||||
# git rm -r .ipynb_checkpoints/
|
||||
data/*
|
||||
history/*
|
||||
logs/*
|
||||
.idea/*
|
||||
!./data
|
||||
!./history
|
||||
!./logs
|
@ -39,7 +39,9 @@ plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.NOTSET)
|
||||
realtime = time.strftime('%Y%m%d', time.localtime(time.time()))
|
||||
fh = logging.FileHandler(Path("history") / (realtime + ".log"), mode='a')
|
||||
if not os.path.exists(Path("logs")):
|
||||
os.makedirs(Path("logs"))
|
||||
fh = logging.FileHandler(Path("logs") / (realtime + ".log"), mode='a')
|
||||
fh.setLevel(logging.NOTSET)
|
||||
fh.setFormatter(logging.Formatter("%(asctime)s: %(message)s"))
|
||||
logger.addHandler(fh)
|
||||
|
Loading…
Reference in New Issue
Block a user