Files
ai-titration/test_logging.py
flt6 be0ba3a3d6 use logging instead print
Former-commit-id: bff176e0e99d1c50f48a63a3fd30adcee67777a8
2025-05-26 23:26:31 +08:00

36 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
测试logging系统的功能
"""
import utils
def test_logging():
"""测试logging系统"""
# 初始化logging
log_file = utils.setup_logging()
print(f"日志文件已创建: {log_file}")
# 获取各个模块的logger
system_logger = utils.get_system_logger()
hardware_logger = utils.get_hardware_logger()
vision_logger = utils.get_vision_logger()
control_logger = utils.get_control_logger()
endpoint_logger = utils.get_endpoint_logger()
volume_logger = utils.get_volume_logger()
# 测试各个模块的日志输出
system_logger.info("系统初始化完成")
hardware_logger.info("硬件连接正常")
vision_logger.debug("图像处理开始")
control_logger.warning("控制逻辑警告")
endpoint_logger.error("终点检测错误")
volume_logger.info("体积计算: 10.5 ml")
print("日志测试完成请检查logs目录下的日志文件。")
if __name__ == "__main__":
test_logging()