9ceb218f80
Co-authored-by: Cursor <cursoragent@cursor.com>
1.4 KiB
1.4 KiB
mylog 模块说明
路径:
app/mylog/
返回主说明:README
1. 模块职责
- 提供统一日志输出入口;
- 管理日志等级、模块输出开关;
- 对接串口/网络日志通道(按工程配置启用)。
2. 关键文件
mylog.cmylog.h
3. 功能说明
- 提供标准日志打印宏/函数,便于各任务统一格式输出;
- 支持运行时日志开关控制,便于现场定位问题;
- 与测试模块联动时可输出周期状态日志。
4. 调度与对外接口
该模块由 FreeRTOS 任务 MyLog 周期运行(单位:ms),周期来自 app/app_init/app_init.c:
MyLog:200ms(任务入口:v_mylog_task(void *argument))
对外接口(来自 mylog.h):
void v_mylog_task(void *argument):日志任务入口void v_format_logMsg(int id, const char *file, int line, const char *func, const char *fmt, ...):内部格式化/输出实现void v_mylog_udp_send_data(const uint8_t *data, uint16_t len):UDP 发送接口(若工程配置启用)MYLOG_MSG(id, fmt, ...):日志宏extern uint8_t u8_task_log_flag[MY_TASK_NUM]:运行时控制各任务日志开关(id对应任务 ID)
5. 维护建议
- 业务模块不要直接依赖底层串口细节,统一走
mylog; - 高频日志建议加节流,避免影响实时任务。
6. 关联文档
- 主索引:README