---
title: Dump日志接口
description: "记录AI CPU算子执行过程中的日志信息，便于功能调测。目前提供DEBUG/INFO/WARNING/ERROR级别的日志接口。日志Dump功能的具体使用方法请参考日志Dump功能使用。"
url: https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/others/tbeaicpudevg/atlascpuapi_10_0090.html
sourcePath: /source/zh/CANNCommunityEdition/920beta1/others/tbeaicpudevg/atlascpuapi_10_0090.html
indexId: acbc227f1c018b3a94f1265b9d352f6c5bb024d09f6558fa5b5b541b708528ab85
---
# Dump日志接口

#### 函数功能

记录AI CPU算子执行过程中的日志信息，便于功能调测。目前提供DEBUG/INFO/WARNING/ERROR级别的日志接口。日志Dump功能的具体使用方法请参考日志Dump功能使用。


#### 函数原型

CUST_KERNEL_LOG_DEBUG(ctx, fmt, ...)

CUST_KERNEL_LOG_INFO(ctx, fmt, ...)

CUST_KERNEL_LOG_WARNING(ctx, fmt, ...)

CUST_KERNEL_LOG_ERROR(ctx, fmt, ...)


注意：如下接口是上述宏定义会调用到的关联接口，开发者不直接调用下列接口。

static void CustLogDebug(aicpu::CpuKernelContext &ctx, const char *fmt, ...);

static void CustLogWarning(aicpu::CpuKernelContext &ctx, const char *fmt, ...);

static void CustLogInfo(aicpu::CpuKernelContext &ctx, const char *fmt, ...);

static void CustLogError(aicpu::CpuKernelContext &ctx, const char *fmt, ...);

static void DumpCustomLog(int32_t module_id, int32_t level, const char *fmt, ...);


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| ctx | 输入 | CPUKernel的上下文信息，CpuKernelContext对象，算子Compute函数的入参。 |
| fmt | 输入 | 格式控制字符串。 |
| ... | 输入 | 附加参数 ，根据不同的fmt 字符串，函数可能需要一系列的附加参数，每个参数包含了一个要被插入的值，替换了 fmt 参数中指定的每个%标签。 |


#### 返回值说明

无。


#### 约束说明

无。


#### 调用示例

```
uint32_t UniqueCpuKernel::Compute(CpuKernelContext &ctx) {
Tensor *param_tensor = ctx.Input(0);
if (param_tensor == nullptr) {
return 1;
}
auto param_shape = param_tensor->GetTensorShape();
if (param_shape == nullptr) {
return 1;
}
int64_t p_size = 1;
for (int i = 0; i < param_shape->GetDims(); ++i) {
p_size *= param_shape->GetDimSize(i);
}
CUST_KERNEL_LOG_DEBUG(ctx, "Cust UniqueCpuKernel Compute, p_size is %ld.", p_size);
}
```
