Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhangjie 的贡献)变更摘要
此 PR 将 master 分支上 acl_log.h 对外开放的 acllog 日志接口相关改动同步到 9.1.0 分支,主要包括在头文件中声明三个 acllog 对外接口、在 slog_api.cpp 中实现接口逻辑,并同步更新相关单元测试用例。
主要改动
- 新增 acllog 对外接口声明: 在
include/dfx/base/acl_log.h中声明了acllogCheckDebugLevel、acllogRecord和acllogVaList三个函数,均带有LOG_FUNC_VISIBILITY导出属性和__attribute((weak))弱符号标记。 - 实现 acllog 接口逻辑: 在
src/dfx/log/liblog/slog/slog_api.cpp中实现了三个接口及辅助函数(IsAcllogUserModuleId、GetAcllogModuleId),并定义了用户模块 ID 范围常量ACLLOG_USER_MODULE_ID_MIN(0xff00)与ACLLOG_USER_MODULE_ID_MAX(0xffff),acllogCheckDebugLevel对用户模块 ID 和系统模块 ID 分别走不同的日志级别检查逻辑。 - 新增异常场景单元测试: 在
alog_host_excp_utest.cc中新增AcllogInterfaceError测试用例,覆盖acllogRecord传入空指针、acllogCheckDebugLevel传入无效日志级别和负数模块 ID 等异常场景。 - 新增功能场景单元测试: 在
alog_host_func_utest.cc中新增AcllogCheckDebugLogLevelInterface和AcllogPrintUserModuleId测试用例,验证不同用户模块 ID 下的日志级别检查及日志输出功能。


代码审查
审查总结
对本次 diff 涉及的 5 个文件逐一完成审查:
| 文件 | 审查结论 |
|---|---|
docs/03_api_ref/23_日志接口.md |
无问题:新增的三个 API 文档(acllogRecord、acllogVaList、acllogCheckDebugLevel)签名正确,参数说明准确,调用示例安全,无危险操作指令。 |
include/dfx/base/acl_log.h |
无问题:新增的三个对外接口声明正确,__attribute((weak)) 弱符号属性与项目现有 alog_pub.h 风格一致,<stdarg.h> 头文件引入合理,format(printf, 3, 4) 属性参数位置正确。 |
src/dfx/log/liblog/slog/slog_api.cpp |
无问题:三个弱符号实现逻辑正确。acllogCheckDebugLevel 正确区隔用户模块 ID(使用全局日志级别)和内部模块 ID(委托 CheckLogLevel);acllogVaList 正确构造 LogMsgArg;acllogRecord 正确封装可变参数转发。nullptr fmt 和负 moduleId 的防御性检查完备。 |
tests/ut/slog/ut/ep/alog_host/testcase/alog_host_excp_utest.cc |
1 个 P3 发现:测试函数/用例名中 "Acllog"(3 个 'l')与 API 前缀 "acllog"(2 个 'l')不一致。 |
tests/ut/slog/ut/ep/alog_host/testcase/alog_host_func_utest.cc |
同上(同一 P3 发现已覆盖此文件)。 |
按优先级统计: P0: 0, P1: 0, P2: 0, P3: 1
总体风险评估: 低风险。此变更引入了三个对外开放的 acllog 日志接口,实现逻辑正确、测试覆盖充分、文档准确。唯一的发现是测试命名中的拼写不一致("Acllog" vs "acllog"),不影响功能正确性。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| ** | ✅ 王涛, gcw_kUomxQ2l (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
newstarzj, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


流水线任务触发成功
任务链接 [a7890109f45040aebdfbaf29727c688f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_acl | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_v201 | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_c | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_david | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_910b | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_common | ✅ SUCCESS | >>>>> | |
| UT_Test_platform | ✅ SUCCESS | >>>>> | |
| UT_Test_qs | ✅ SUCCESS | >>>>> | |
| UT_Test_aicpusd | ✅ SUCCESS | >>>>> | |
| UT_Test_tsd | ✅ SUCCESS | >>>>> | |
| UT_Test_error_manager | ✅ SUCCESS | >>>>> | |
| UT_Test_slog | ✅ SUCCESS | >>>>> | |
| UT_Test_atrace | ✅ SUCCESS | >>>>> | |
| UT_Test_adump | ✅ SUCCESS | >>>>> | |
| UT_Test_mmpa | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof | ✅ SUCCESS | >>>>> | |
| UT_Test_rts_report | ✅ SUCCESS | >>>>> | |
| UT_Test_msprof_report | ✅ SUCCESS |
[2026-07-07 14:47:51] CI执行结束


流水线任务触发成功
任务链接 [e4187e72343844cda7029118576e3f6f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_Check_Pr | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS |
[2026-07-07 14:44:08] CI执行结束


/approve


Pull Request
描述
将 master 上 acl_log.h 对外开放 acllog 日志接口相关改动同步到 9.1.0 分支:
变更类型
请选择本次引入的变更类型:
关联的Issue
https://gitcode.com/cann/runtime/issues/639
如何测试
测试结果:PASS
核对清单
其他信息
同步提交: