Files
CCU621M/app/mylog/mylog模块说明.md
T

45 lines
1.4 KiB
Markdown
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.
# mylog 模块说明
> 路径:`app/mylog/`
> 返回主说明:[README](../../README.md)
## 1. 模块职责
- 提供统一日志输出入口;
- 管理日志等级、模块输出开关;
- 对接串口/网络日志通道(按工程配置启用)。
## 2. 关键文件
- `mylog.c`
- `mylog.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](../../README.md)