mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-04 13:25:13 +00:00
* feat(bioyond): 添加计算实验设计功能,支持化合物配比和滴定比例参数 * feat(bioyond): 添加测量小瓶功能,支持基本参数配置 * feat(bioyond): 添加测量小瓶配置,支持新设备参数 * feat(bioyond): 更新仓库布局和尺寸,支持竖向排列的测量小瓶和试剂存放堆栈 * feat(bioyond): 优化任务创建流程,确保无论成功与否都清理任务队列以避免重复累积 * feat(bioyond): 添加设置反应器温度功能,支持温度范围和异常处理 * feat(bioyond): 调整反应器位置配置,统一坐标格式 * feat(bioyond): 添加调度器启动功能,支持任务队列执行并处理异常 * feat(bioyond): 优化调度器启动功能,添加异常处理并更新相关配置 * feat(opcua): 增强节点ID解析兼容性和数据类型处理 改进节点ID解析逻辑以支持多种格式,包括字符串和数字标识符 添加数据类型转换处理,确保写入值时类型匹配 优化错误提示信息,便于调试节点连接问题 * feat(registry): 新增后处理站的设备配置文件 添加后处理站的YAML配置文件,包含动作映射、状态类型和设备描述 * 添加调度器启动功能,合并物料参数配置,优化物料参数处理逻辑 * 添加从 Bioyond 系统自动同步工作流序列的功能,并更新相关配置 * fix:兼容 BioyondReactionStation 中 workflow_sequence 被重写为 property * fix:同步工作流序列 * feat: remove commented workflow synchronization from `reaction_station.py`. * 添加时间约束功能及相关配置 * fix:自动更新物料缓存功能,添加物料时更新缓存并在删除时移除缓存项 * fix:在添加物料时处理字符串和字典返回值,确保正确更新缓存 * fix:更新奔曜错误处理报送为物料变更报送,调整日志记录和响应消息 * feat:添加实验报告简化功能,去除冗余信息并保留关键信息 * feat: 添加任务状态事件发布功能,监控并报告任务运行、超时、完成和错误状态 * fix: 修复添加物料时数据格式错误 * Refactor bioyond_dispensing_station and reaction_station_bioyond YAML configurations - Removed redundant action value mappings from bioyond_dispensing_station. - Updated goal properties in bioyond_dispensing_station to use enums for target_stack and other parameters. - Changed data types for end_point and start_point in reaction_station_bioyond to use string enums (Start, End). - Simplified descriptions and updated measurement units from μL to mL where applicable. - Removed unused commands from reaction_station_bioyond to streamline the configuration. * fix:Change the material unit from μL to mL * fix:refresh_material_cache * feat: 动态获取工作流步骤ID,优化工作流配置 * feat: 添加清空服务端所有非核心工作流功能 * fix:修复Bottle类的序列化和反序列化方法 * feat:增强材料缓存更新逻辑,支持处理返回数据中的详细信息 * Add debug log * feat(workstation): update bioyond config migration and coin cell material search logic - Migrate bioyond_cell config to JSON structure and remove global variable dependencies - Implement material search confirmation dialog auto-handling - Add documentation: 20260113_物料搜寻确认弹窗自动处理功能.md and 20260113_配置迁移修改总结.md * Refactor module paths for Bioyond devices in YAML configuration files - Updated the module path for BioyondDispensingStation in bioyond_dispensing_station.yaml to reflect the new directory structure. - Updated the module path for BioyondReactionStation and BioyondReactor in reaction_station_bioyond.yaml to align with the revised organization of the codebase. * fix: WareHouse 的不可哈希类型错误,优化父节点去重逻辑 * refactor: Move config from module to instance initialization * fix: 修正 reaction_station 目录名拼写错误 * feat: Integrate material search logic and cleanup deprecated files - Update coin_cell_assembly.py with material search dialog handling - Update YB_warehouses.py with latest warehouse configurations - Remove outdated documentation and test data files * Refactor: Use instance attributes for action names and workflow step IDs * refactor: Split tipbox storage into left and right warehouses * refactor: Merge tipbox storage left and right into single warehouse --------- Co-authored-by: ZiWei <131428629+ZiWei09@users.noreply.github.com> Co-authored-by: Andy6M <xieqiming1132@qq.com>
188 lines
5.5 KiB
Markdown
188 lines
5.5 KiB
Markdown
# UniLabOS 日志配置说明
|
||
|
||
> **文件位置**: `unilabos/utils/log.py`
|
||
> **最后更新**: 2026-01-11
|
||
> **维护者**: Uni-Lab-OS 开发团队
|
||
|
||
本文档说明 UniLabOS 日志系统中对第三方库和内部模块的日志级别配置,避免控制台被过多的 DEBUG 日志淹没。
|
||
|
||
---
|
||
|
||
## 📋 已屏蔽的日志
|
||
|
||
以下库/模块的日志已被设置为 **WARNING** 或 **INFO** 级别,不再显示 DEBUG 日志:
|
||
|
||
### 1. pymodbus(Modbus 通信库)
|
||
|
||
**配置位置**: `log.py` 第196-200行
|
||
|
||
```python
|
||
# pymodbus 库的日志太详细,设置为 WARNING
|
||
logging.getLogger('pymodbus').setLevel(logging.WARNING)
|
||
logging.getLogger('pymodbus.logging').setLevel(logging.WARNING)
|
||
logging.getLogger('pymodbus.logging.base').setLevel(logging.WARNING)
|
||
logging.getLogger('pymodbus.logging.decoders').setLevel(logging.WARNING)
|
||
```
|
||
|
||
**屏蔽原因**:
|
||
- pymodbus 在 DEBUG 级别会输出每一次 Modbus 通信的详细信息
|
||
- 包括 `Processing: 0x5 0x1e 0x0 0x0...` 等原始数据
|
||
- 包括 `decoded PDU function_code(3 sub -1) -> ReadHoldingRegistersResponse(...)` 等解码信息
|
||
- 这些信息对日常使用价值不大,但会快速刷屏
|
||
|
||
**典型被屏蔽的日志**:
|
||
```
|
||
[DEBUG] Processing: 0x5 0x1e 0x0 0x0 0x0 0x7 0x1 0x3 0x4 0x0 0x0 0x0 0x0 [handleFrame:72] [pymodbus.logging.base]
|
||
[DEBUG] decoded PDU function_code(3 sub -1) -> ReadHoldingRegistersResponse(...) [decode:79] [pymodbus.logging.decoders]
|
||
```
|
||
|
||
---
|
||
|
||
### 2. websockets(WebSocket 库)
|
||
|
||
**配置位置**: `log.py` 第202-205行
|
||
|
||
```python
|
||
# websockets 库的日志输出较多,设置为 WARNING
|
||
logging.getLogger('websockets').setLevel(logging.WARNING)
|
||
logging.getLogger('websockets.client').setLevel(logging.WARNING)
|
||
logging.getLogger('websockets.server').setLevel(logging.WARNING)
|
||
```
|
||
|
||
**屏蔽原因**:
|
||
- WebSocket 连接、断开、心跳等信息在 DEBUG 级别会频繁输出
|
||
- 对于长时间运行的服务,这些日志意义不大
|
||
|
||
---
|
||
|
||
### 3. ROS Host Node(设备状态更新)
|
||
|
||
**配置位置**: `log.py` 第207-208行
|
||
|
||
```python
|
||
# ROS 节点的状态更新日志过于频繁,设置为 INFO
|
||
logging.getLogger('unilabos.ros.nodes.presets.host_node').setLevel(logging.INFO)
|
||
```
|
||
|
||
**屏蔽原因**:
|
||
- 设备状态更新(如手套箱压力)每隔几秒就会更新一次
|
||
- DEBUG 日志会记录每一次状态变化,导致日志刷屏
|
||
- 这些频繁的状态更新对调试价值不大
|
||
|
||
**典型被屏蔽的日志**:
|
||
```
|
||
[DEBUG] [/devices/host_node] Status updated: BatteryStation.data_glove_box_pressure = 4.229457855224609 [property_callback:666] [unilabos.ros.nodes.presets.host_node]
|
||
```
|
||
|
||
---
|
||
|
||
### 4. asyncio 和 urllib3
|
||
|
||
**配置位置**: `log.py` 第224-225行
|
||
|
||
```python
|
||
logging.getLogger("asyncio").setLevel(logging.INFO)
|
||
logging.getLogger("urllib3").setLevel(logging.INFO)
|
||
```
|
||
|
||
**屏蔽原因**:
|
||
- asyncio: 异步 IO 的内部调试信息
|
||
- urllib3: HTTP 请求库的连接池、重试等详细信息
|
||
|
||
---
|
||
|
||
## 🔧 如何临时启用这些日志(调试用)
|
||
|
||
### 方法1: 修改 log.py(永久启用)
|
||
|
||
在 `log.py` 的 `configure_logger()` 函数中,将对应库的日志级别改为 `logging.DEBUG`:
|
||
|
||
```python
|
||
# 临时启用 pymodbus 的 DEBUG 日志
|
||
logging.getLogger('pymodbus').setLevel(logging.DEBUG)
|
||
logging.getLogger('pymodbus.logging').setLevel(logging.DEBUG)
|
||
logging.getLogger('pymodbus.logging.base').setLevel(logging.DEBUG)
|
||
logging.getLogger('pymodbus.logging.decoders').setLevel(logging.DEBUG)
|
||
```
|
||
|
||
### 方法2: 在代码中临时启用(单次调试)
|
||
|
||
在需要调试的代码文件中添加:
|
||
|
||
```python
|
||
import logging
|
||
|
||
# 临时启用 pymodbus DEBUG 日志
|
||
logging.getLogger('pymodbus').setLevel(logging.DEBUG)
|
||
|
||
# 你的 Modbus 调试代码
|
||
...
|
||
|
||
# 调试完成后恢复
|
||
logging.getLogger('pymodbus').setLevel(logging.WARNING)
|
||
```
|
||
|
||
### 方法3: 使用环境变量或配置文件(推荐)
|
||
|
||
未来可以考虑在启动参数中添加 `--debug-modbus` 等选项来动态控制。
|
||
|
||
---
|
||
|
||
## 📊 日志级别说明
|
||
|
||
| 级别 | 数值 | 用途 | 是否显示 |
|
||
|------|------|------|---------|
|
||
| TRACE | 5 | 最详细的跟踪信息 | ✅ |
|
||
| DEBUG | 10 | 调试信息 | ✅ |
|
||
| INFO | 20 | 一般信息 | ✅ |
|
||
| WARNING | 30 | 警告信息 | ✅ |
|
||
| ERROR | 40 | 错误信息 | ✅ |
|
||
| CRITICAL | 50 | 严重错误 | ✅ |
|
||
|
||
**当前配置**:
|
||
- UniLabOS 自身代码: DEBUG 及以上全部显示
|
||
- pymodbus/websockets: **WARNING** 及以上显示(屏蔽 DEBUG/INFO)
|
||
- ROS host_node: **INFO** 及以上显示(屏蔽 DEBUG)
|
||
|
||
---
|
||
|
||
## ⚠️ 重要提示
|
||
|
||
### 修改生效时间
|
||
- 修改 `log.py` 后需要 **重启 unilab 服务** 才能生效
|
||
- 不需要重新安装或重新编译
|
||
|
||
### 调试 Modbus 通信问题
|
||
如果需要调试 Modbus 通信故障,应该:
|
||
1. 临时启用 pymodbus DEBUG 日志(方法2)
|
||
2. 复现问题
|
||
3. 查看详细的通信日志
|
||
4. 调试完成后记得恢复 WARNING 级别
|
||
|
||
### 调试设备状态问题
|
||
如果需要调试设备状态更新问题:
|
||
```python
|
||
logging.getLogger('unilabos.ros.nodes.presets.host_node').setLevel(logging.DEBUG)
|
||
```
|
||
|
||
---
|
||
|
||
## 📝 维护记录
|
||
|
||
| 日期 | 修改内容 | 操作人 |
|
||
|------|---------|--------|
|
||
| 2026-01-11 | 初始创建,添加 pymodbus、websockets、ROS host_node 屏蔽 | - |
|
||
| 2026-01-07 | 添加 pymodbus 和 websockets 屏蔽(log-0107.py) | - |
|
||
|
||
---
|
||
|
||
## 🔗 相关文件
|
||
|
||
- `log.py` - 日志配置主文件
|
||
- `unilabos/devices/workstation/coin_cell_assembly/` - 使用 Modbus 的扣电工作站代码
|
||
- `unilabos/ros/nodes/presets/host_node.py` - ROS 主机节点代码
|
||
|
||
---
|
||
|
||
**维护提示**: 如果添加了新的第三方库或发现新的日志刷屏问题,请在此文档中记录并更新 `log.py` 配置。
|