关闭日志系统 - LogShutdown
函数简介
关闭用户日志系统并释放资源。
接口名称
LogShutdown
DLL调用
int32_t LogShutdown(int64_t instance, int64_t loggerHandle)
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | int64_t | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成 |
| loggerHandle | int64_t | 日志实例句柄(0 表示默认实例) |
示例
// 关闭默认日志实例
int result = LogShutdown(instance, 0);
// 关闭自定义日志实例
int64_t networkLogger = LogCreateInstance(instance, "NetworkLogger");
// ... 使用日志 ...
LogShutdown(instance, networkLogger);
// 程序退出前关闭所有日志
LogShutdown(instance, networkLogger);
LogShutdown(instance, dbLogger);
LogShutdown(instance, 0); // 最后关闭默认实例
返回值
| 返回值 | 说明 |
|---|---|
| 0 | 失败 |
| 1 | 成功 |
注意事项
- 关闭后,下次写入日志时会自动重新初始化
- 通常在程序退出前调用,或需要完全重置日志系统时使用
- 关闭前会自动刷新所有缓冲区中的日志
- 关闭后会释放所有相关资源(文件句柄、内存等)
- 不建议频繁调用,会影响性能
