新增日志记录
This commit is contained in:
parent
bca4ee4e05
commit
bc2cf2ed74
|
@ -2,7 +2,7 @@
|
|||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/EasyTest.iml" filepath="$PROJECT_DIR$/.idea/EasyTest.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/t2-api-autotest.iml" filepath="$PROJECT_DIR$/.idea/t2-api-autotest.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2023/3/28 11:24
|
||||
# @Author : 谈林海
|
||||
import time
|
||||
import loguru
|
||||
from utils.path import root
|
||||
|
||||
log_path = root / 'logs'
|
||||
|
||||
|
||||
class Loggings:
|
||||
"""重写日志操作方法"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
loggers = loguru.logger
|
||||
loggers.add(f"{log_path}/log_{time.strftime('%Y_%m_%d')}.log", rotation="12:00", encoding="utf-8",
|
||||
enqueue=True, retention="10 days")
|
||||
return loggers
|
||||
|
||||
|
||||
logger = Loggings()
|
||||
|
Loading…
Reference in New Issue