主题
写入TRACE日志Ex - LogTraceEx
函数简介
写入 TRACE 级别日志(扩展版本),支持指定日志实例。
接口名称
LogTraceExDLL调用
c
int32_t LogTraceEx(int64_t instance, int64_t loggerHandle, const char* message);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| loggerHandle | 长整数型 | 日志实例句柄(0 表示默认实例)。 |
| message | 字符串 | 日志消息。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.LogTraceEx(0, "value");csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.LogTraceEx(0, "value");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.LogTraceEx(0, "value")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.LogTraceEx(0, "value");cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.LogTraceEx(0, "value")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.LogTraceEx(0, "value")text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.LogTraceEx(0, “value”)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.LogTraceEx(0, "value");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.LogTraceEx(0, "value")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.LogTraceEx(0, "value");原生 DLL 调用
cpp
LogTraceEx(instance, 0, "value");csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int LogTraceEx(long ola, int loggerHandle, string message);
LogTraceEx(instance, 0, "value");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.LogTraceEx(instance, 0, "value")返回值
| 返回值 | 说明 |
|---|---|
1 | 成功。 |
0 | 失败。 |
注意事项
| 项目 | 说明 |
|---|---|
| TRACE 是最低级别的日志 | TRACE 是最低级别的日志,用于详细的程序执行跟踪。 |
| 只有当日志级别设置为 `OLA_LOG_LEVE | 只有当日志级别设置为 OLA_LOG_LEVEL_TRACE (0) 时才会输出。 |
与 LogTrace 的区别 | 支持指定日志实例,适合多实例场景。 |
| 如果日志系统未初始化 | 如果日志系统未初始化,第一次调用时会自动初始化。 |
