写入DEBUG日志 - LogDebug
函数简介
写入 DEBUG 级别日志到默认日志实例。
接口名称
LogDebug
DLL调用
int32_t LogDebug(int64_t instance, const char* message)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | int64_t | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成 |
| message | string | 日志消息 |
示例
// 写入DEBUG日志
int result = LogDebug(instance, "调试信息:变量值 = 123");
// 记录调试信息
LogDebug(instance, "开始连接数据库");
LogDebug(instance, "数据库连接成功");
// 记录函数调用
char buffer[256];
sprintf(buffer, "调用函数 Calculate,参数:a=%d, b=%d", a, b);
LogDebug(instance, buffer);
返回值
| 返回值 | 说明 |
|---|---|
| 0 | 失败 |
| 1 | 成功 |
注意事项
- DEBUG 级别用于调试信息,帮助开发者定位问题
- 只有当日志级别设置为
OLA_LOG_LEVEL_DEBUG(1) 或更低时才会输出 - 建议在开发阶段使用,生产环境可以提高日志级别以减少输出
- 如果需要指定日志实例,请使用
LogDebugEx - 如果日志系统未初始化,第一次调用时会自动初始化
