log测试更新
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/logs" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13 (intelligence_system)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
|
||||
+23
-9
@@ -1,13 +1,27 @@
|
||||
# test_logger.py
|
||||
from utils.logger import log
|
||||
import platform
|
||||
# from utils.logger import log
|
||||
# import platform
|
||||
#
|
||||
# def test_logging():
|
||||
# log.info(f"当前系统: {platform.system()}")
|
||||
# try:
|
||||
# 1/0
|
||||
# except:
|
||||
# log.error("除零错误", exc_info=True)
|
||||
#
|
||||
# if __name__ == "__main__":
|
||||
# test_logging()
|
||||
|
||||
def test_logging():
|
||||
log.info(f"当前系统: {platform.system()}")
|
||||
try:
|
||||
1/0
|
||||
except:
|
||||
log.error("除零错误", exc_info=True)
|
||||
|
||||
# test_log_rotation.py
|
||||
from utils.logger import log
|
||||
import time
|
||||
|
||||
def generate_large_log():
|
||||
"""快速生成超过20MB的测试日志"""
|
||||
for i in range(10000):
|
||||
log.info(f"测试日志填充数据... {i}" * 10)
|
||||
time.sleep(0.001) # 避免内存暴涨
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_logging()
|
||||
generate_large_log()
|
||||
Reference in New Issue
Block a user