增加日志
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using OpenCvSharp;
|
||||
using Ayay.SerilogLogs;
|
||||
using OpenCvSharp;
|
||||
using Serilog;
|
||||
using SHH.CameraSdk.HikFeatures;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Security;
|
||||
@@ -17,6 +19,8 @@ public class HikVideoSource : BaseVideoSource,
|
||||
{
|
||||
#region --- 静态资源 (Global Resources) ---
|
||||
|
||||
// 日志实例
|
||||
private static ILogger _sdkLog = Log.ForContext("SourceContext", LogModules.HikVisionSdk);
|
||||
// 静态路由表
|
||||
private static readonly ConcurrentDictionary<int, HikVideoSource> _instances = new();
|
||||
// 全局异常回调
|
||||
@@ -103,14 +107,18 @@ public class HikVideoSource : BaseVideoSource,
|
||||
if (currentEpoch != _connectionEpoch) return;
|
||||
|
||||
if (!HikSdkManager.Initialize())
|
||||
throw new CameraException(CameraErrorCode.SdkNotInitialized, "SDK初始化失败", DeviceBrand.HikVision);
|
||||
{
|
||||
_sdkLog.Error("HikVision Sdk 初始化失败.");
|
||||
throw new CameraException(CameraErrorCode.SdkNotInitialized, "HikVision Sdk 初始化失败.", DeviceBrand.HikVision);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
HikNativeMethods.NET_DVR_SetExceptionCallBack_V30(0, IntPtr.Zero, _globalExceptionCallback, IntPtr.Zero);
|
||||
|
||||
// [审计] 记录登录动作
|
||||
AddAuditLog($"正在执行物理登录... ({_config.IpAddress})");
|
||||
AddAuditLog($"Hik 正在执行登录 => ID:{_config.Id} IP:{_config.IpAddress} Port:{_config.Port} Name:{_config.Name}");
|
||||
_sdkLog.Information($"Hik 正在执行登录 => ID:{_config.Id} IP:{_config.IpAddress} Port:{_config.Port} Name:{_config.Name}");
|
||||
|
||||
var devInfo = new HikNativeMethods.NET_DEVICEINFO_V30();
|
||||
int newUserId = HikNativeMethods.NET_DVR_Login_V30(
|
||||
|
||||
Reference in New Issue
Block a user