Skip to content

写入INFO日志 - LogInfo

函数简介

写入 INFO 级别日志到默认日志实例。

接口名称

LogInfo

DLL调用

c
int32_t LogInfo(int64_t instance, const char* message);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
message字符串日志消息。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
long log = ola.LogCreateInstance();
ola.LogInfo(log, "operation done");
csharp
using OLAPlug;

var ola = new OLAPlugServer();
long log = ola.LogCreateInstance();
ola.LogInfo(log, "operation done");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
log = ola.LogCreateInstance()
ola.LogInfo(log, "operation done")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
long log = ola.LogCreateInstance();
ola.LogInfo(log, "operation done");
go
import "github.com/ola/olaplug/olaplug"

ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
log := ola.LogCreateInstance()
ola.LogInfo(log, "operation done")
rust
use olaplug::OLAPlugServer;

let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let log = ola.log_create_instance();
ola.log_info(&log, "operation done");
cpp
var ola = com("OlaPlug.OlaSoft")
var log = ola.LogCreateInstance()
ola.LogInfo(log, "operation done");
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
log = ola.LogCreateInstance()
ola.LogInfo(log, "operation done");
text
.局部变量 ola, OLAPlug
ola.创建 ()
log = ola.LogCreateInstance()
ola.LogInfo(log, "operation done")
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var log = ola.LogCreateInstance();
ola.LogInfo(log, "operation done");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
长整数 log = ola.LogCreateInstance()
ola.LogInfo(log, "operation done");
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
long log = ola.LogCreateInstance();
ola.LogInfo(log, "operation done");

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
long log = LogCreateInstance(instance);
LogInfo(instance, log, "operation done");
csharp
long instance = CreateCOLAPlugInterFace();
long log = LogCreateInstance(instance);
LogInfo(instance, log, "operation done");
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
log = LogCreateInstance(instance)
LogInfo(instance, log, "operation done")

返回值

返回值说明
1成功。
0失败。

注意事项

项目说明
INFO 级别用于记录程序的正常运行信息INFO 级别用于记录程序的正常运行信息。
OLA_LOG_LEVEL_INFO只有当日志级别设置为 OLA_LOG_LEVEL_INFO (2) 或更低时才会输出。
这是默认的日志级别这是默认的日志级别,适合生产环境使用。
如果需要指定日志实例如果需要指定日志实例,请使用 LogInfoEx
如果日志系统未初始化如果日志系统未初始化,第一次调用时会自动初始化。