本文整理汇总了C#中NLogEx.LoggerEx类的典型用法代码示例。如果您正苦于以下问题:C# NLogEx.LoggerEx类的具体用法?C# NLogEx.LoggerEx怎么用?C# NLogEx.LoggerEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NLogEx.LoggerEx类属于命名空间,在下文中一共展示了NLogEx.LoggerEx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssignMonitorChannel
/// <summary>
/// 分配监控通道
/// </summary>
public SmcErr AssignMonitorChannel(List<ChannelInfo> ChannelInfoList)
{
SmcErr err = new CgwError();
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
err = CheckSession();
if (err.IsSuccess())
{
if (ChannelInfoList != null)
{
err = MonitorChannelBll.Instance().AssignMonitorChannel(ChannelInfoList);
}
else
{
err.SetErrorNo(CgwError.ERR_CGW_BUSINESS_CHANNELLIST_NULL);
}
}
if (err.IsSuccess())
{
logEx.Trace("AssignMonitorChannel Successful");
}
else
{
logEx.Error("AssignMonitorChannel failed,ErrNo :{0}", err.ErrNo);
}
return err;
}
示例2: ESDK_RTP_Init
/// <summary>
/// 初始化rtp模块
/// </summary>
public void ESDK_RTP_Init()
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: RtpAdapter.ESDK_RTP_Init().");
try
{
int iRet = 0;
if (!isInited)
{
iRet = SdkRtpInterface.ESDK_RTP_Init();
logEx.Trace("Enter: RtpAdapter.ESDK_RTP_Init(). This is first init!");
}
if (iRet != 0)
{
logEx.Error("RtpAdapter.ESDK_RTP_Init ,error:{0}", iRet);
isInited = false;
}
else
{
logEx.Trace("Enter: RtpAdapter.ESDK_RTP_Init().Success");
isInited = true;
}
logEx.Trace("Enter: RtpAdapter.ESDK_RTP_Init(). inited is {0}!", isInited);
}
catch (System.Exception ex)
{
logEx.Error("RtpAdapter.ESDK_RTP_Init ,Exception:{0}", ex.ToString());
isInited = false;
}
}
示例3: StopService
/// <summary>
/// 停止服务
/// </summary>
public override void StopService()
{
if (serviceHost != null)
{
NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
CgwService.Instance().StopAllStream();//stop all stream.
SmcErr err = CgwService.Instance().DisconnectMonitor();
logEx.Info("CGW service.StopService DisconnectMonitor.ErrNo ={0}!", err.ErrNo);
serviceHost.Close();
logEx.Info("CGW service.StopService Close Success.");
}
}
示例4: ESDK_RTP_CloseChannel
/// <summary>
/// 关闭通道
/// </summary>
/// <param name="uiChannel"></param>
public void ESDK_RTP_CloseChannel(uint uiChannel)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: RtpAdapter.ESDK_RTP_CloseChannel().");
try
{
int iRet = SdkRtpInterface.ESDK_RTP_CloseChannel(uiChannel);
if (iRet != 0)
{
logEx.Error("RtpAdapter.ESDK_RTP_CloseChannel ,error:{0}", iRet);
}
}
catch (System.Exception ex)
{
logEx.Error("RtpAdapter.ESDK_RTP_CloseChannel ,Exception:{0}", ex.ToString());
}
}
示例5: LoadMonitorTimer_Elapsed
/// <summary>
/// 线程加载监控平台
/// </summary>
private static void LoadMonitorTimer_Elapsed()
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
System.Threading.Thread.Sleep(CgwConst.Thread_Sleep_Time);
SmcErr smcErr = new SmcErr();
try
{
smcErr = MonitorManageService.Instance().Load();
if (false == smcErr.IsSuccess())
{
logEx.Error("MonitorManageService Start failed! Errno :{0}", smcErr.ErrNo);
NLog.LogManager.Flush();
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
catch (Exception ex)
{
logEx.Fatal(ex, "MonitorManageService LoadMonitor Failed!");
NLog.LogManager.Flush();
}
}
示例6: GetCustomTree
/// <summary>
/// 获取自定义设备列表
/// </summary>
/// <returns>成功返回对象列表,失败返回null</returns>
public List<Resource> GetCustomTree()
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyHttpClient.GetCustomTree().");
//设置访问天地伟业登陆接口的uri
string requestUrl = string.Format(
"{0}/GetCustomTree.jsp?CurrentUserId={1}&UserId={2}&Password={3}",
this.serverUrl,
this.user,
this.user,
pwd);
//日志不能记密码,单独处理
string logString = string.Format(
"{0}/GetCustomTree.jsp?CurrentUserId={1}&UserId={2}&Password=******",
this.serverUrl,
this.user,
this.user);
logEx.Trace("Call function TiandyHttpClient.GetResourceTree({0}).", logString);
List<Resource> resources = GetResourceTree(requestUrl);
return resources;
}
示例7: GetAllCamerasTimer
/// <summary>
/// 获取摄像头列表及分组信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GetAllCamerasTimer(object sender, System.Timers.ElapsedEventArgs e)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyVideoMonitor.GetAllCamerasTimer().");
if (refreshMonitorCameraOperateLock.TryEnterWriteLock(CgwConst.EFRESH_MONITOR_CAMERA_WAIT_TIME))
{
try
{
GetAllCamerasMethod();
}
finally
{
refreshMonitorCameraOperateLock.ExitWriteLock();
}
}
}
示例8: ClearCamera
/// <summary>
/// 清除缓存数据
/// </summary>
private void ClearCamera()
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyVideoMonitor.ClearCamera().");
if (this.cameraOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
this.tiandyCameraDictionary = new Dictionary<string, TiandyCamera>();
this.hostDictionary = new Dictionary<string, Host>();
this.mediaServerDictionary = new Dictionary<string, MediaServer>();
this.groupDic = new Dictionary<string, CameraGroup>();
this.nodeRelationList = new List<NodeRelation>();
}
finally
{
this.cameraOperateLock.ExitWriteLock();
}
}
logEx.Trace("Clear Camera which in the cache success.");
}
示例9: StopReceiveVideo
/// <summary>
/// 停止预览
/// </summary>
/// <param name="cameraNo">摄像头编号</param>
/// <returns>成功返回0,失败返回错误码</returns>
public SmcErr StopReceiveVideo(string cameraNo)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyVideoMonitor.StopReceiveVideo({0}).", cameraNo);
SmcErr err = new CgwError();
//需要停止的预览句柄
int needToStopHandel = CgwConst.START_RECEIVE_VIDEO_DATA_FAILED;
if (this.handelOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
if (this.cameraVideoHandeDic.ContainsKey(cameraNo))
{
needToStopHandel = this.cameraVideoHandeDic[cameraNo];
this.videoHandleCameraDic.Remove(needToStopHandel);
this.cameraVideoHandeDic.Remove(cameraNo);
}
else
{
//不存在,表示已经删除,不返回错误
//err.SetErrorNo(CgwError.STOP_RECEIVE_VIDEO_FAILED);
logEx.Warn("Stop Receive camera video data failed. Don't need to end the preview.Camera No:{0}.", cameraNo);
}
}
finally
{
this.handelOperateLock.ExitWriteLock();
}
}
//调用sdk的停止方法,放在handelOperateLock外面,防止长时间占用锁
if (needToStopHandel != CgwConst.START_RECEIVE_VIDEO_DATA_FAILED)
{
this.sdkClient.StopReceiveVideo(needToStopHandel);
}
logEx.Info("Stop Receive camera video data success.Camera No:{0},Handle:{1}.", cameraNo, needToStopHandel);
return err;
}
示例10: StartReceiveVideo
/// <summary>
/// 启动摄像头预览
/// </summary>
/// <param name="cameraNo">摄像头编号</param>
/// <returns></returns>
public SmcErr StartReceiveVideo(string cameraNo)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyVideoMonitor.StartReceiveVideo({0}).", cameraNo);
SmcErr err = new CgwError();
TiandyCamera camera = null;
Host host = null;
//摄像头所连接的流媒体服务器
MediaServer cameraMediaServer = null;
if (this.cameraOperateLock.TryEnterReadLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
if (!this.tiandyCameraDictionary.ContainsKey(cameraNo))
{
err.SetErrorNo(CgwError.CAMERA_NOT_FOUND);
logEx.Error("Start Receive camera video data failed.Camera No is not found.Camera No:{0}", cameraNo);
return err;
}
camera = this.tiandyCameraDictionary[cameraNo];
host = this.hostDictionary[camera.HostNo];
cameraMediaServer = this.mediaServerDictionary[host.MediaServerNo];
}
catch (Exception e)
{
err.SetErrorNo(CgwError.START_RECEIVE_VIDEO_FAILED);
logEx.Error("Start Receive camera video data failed.Camera No:{0},Execption message:{1}", cameraNo, e.Message);
return err;
}
finally
{
this.cameraOperateLock.ExitReadLock();
}
}
if (camera == null)
{
err.SetErrorNo(CgwError.START_RECEIVE_VIDEO_FAILED);
logEx.Error("Start Receive camera video data failed.Camera No is not found.Camera No:{0}", cameraNo);
return err;
}
RealPlayInfo real = new RealPlayInfo();
real.ch = camera.Channel;
real.data_type = (int)TiandyDateType.PRIMARY;
real.hPlayWnd = null;
int result = this.sdkClient.StartReceiveVideo(host.No, cameraMediaServer, ref real);
//如果为负数,表示预览失败
if (result < 0)
{
err.SetErrorNo(CgwError.START_RECEIVE_VIDEO_FAILED);
logEx.Error("Start Receive camera video data failed.Camera No:{0}.", cameraNo);
return err;
}
else
{
//需要停止的预览句柄
int needToStopHandel = CgwConst.START_RECEIVE_VIDEO_DATA_FAILED;
if (this.handelOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
//如果预览句柄已经存在,删除掉原来的句柄,用新的句柄替换
if (this.cameraVideoHandeDic.ContainsKey(cameraNo))
{
needToStopHandel = this.cameraVideoHandeDic[cameraNo];
this.videoHandleCameraDic.Remove(needToStopHandel);
this.cameraVideoHandeDic.Remove(cameraNo);
}
this.cameraVideoHandeDic.Add(cameraNo, result);
this.videoHandleCameraDic.Add(result, cameraNo);
}
finally
{
this.handelOperateLock.ExitWriteLock();
}
}
logEx.Info("Start Receive camera video data success.Camera No:{0},Handle:{1}.", cameraNo, result);
//重新预览后,更新了预览句柄,需要将原来的预览停止,放在handelOperateLock外面,防止长时间占用锁
if (needToStopHandel != CgwConst.START_RECEIVE_VIDEO_DATA_FAILED)
{
this.sdkClient.StopReceiveVideo(needToStopHandel);
}
}
return err;
}
示例11: SetDataCallBackFunc
/// <summary>
/// 指定码流回调函数
/// </summary>
/// <param name="videoDataCallBack"></param>
/// <param name="sender"></param>
public void SetDataCallBackFunc(DataCallBack dataCallBack, string sender)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyVideoMonitor.SetDataCallBackFunc().");
this.dataCallBack = dataCallBack;
this.sender = sender;
}
示例12: Load
/// <summary>
/// 初始化天地伟业监控平台
/// </summary>
/// <param name="monitorConfigElement">监控平台配置节点</param>
/// <returns></returns>
public SmcErr Load(XmlElement monitorConfigElement)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: TiandyVideoMonitor.Load().");
SmcErr err = new CgwError();
string userLevel = "";
//解析xml节点,获取所需参数
try
{
#region Tiandy视频监控平台(Easy7)连接信息
this.monitorId = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.ID_TAG);
userLevel = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.PTZCONTROLLEVEL_TAG);
string httpUser = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.PLATFORM_USER_TAG);
string httpPassword = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.PLATFORM_PASSWORD_TAG);
string httpUrl = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.PLATFORM_URL_TAG);
string mediaServerId = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.MEDIASERVER_SERVERID_TAG);
#endregion
this.httpClient = new TiandyHttpClient(httpUrl, httpUser, httpPassword);
//使用线程轮询加载监控平台
Thread loaderThread = new Thread(LoaderThread);
loaderThread.Start(mediaServerId);
}
catch (Exception e)
{
err.SetErrorNo(CgwError.MONITOR_CONFIG_FILE_INVALID);
logEx.Error("Load Tiandy monitor failed.Execption message:{0}.", e.Message);
return err;
}
this.sdkClient = new TiandySdkClient();
//如果控制级别配置错误,只记录错误日志,不向外报错
try
{
this.sdkClient.PtzControlLevel = int.Parse(userLevel);
}
catch (Exception e)
{
logEx.Error("Ptz Control Level is invalid.Execption message:{0}.", e.Message);
this.sdkClient.PtzControlLevel = CgwConst.PTZ_CONTROL_LEVEL;
}
logEx.Info("Load video monitor success.Monitor id:{0}.", this.monitorId);
return err;
}
示例13: StopReceiveVideo
/// <summary>
/// 停止预览
/// </summary>
/// <param name="cameraNo">摄像头编号</param>
/// <returns>成功返回0,失败返回错误码</returns>
public SmcErr StopReceiveVideo(string cameraNo)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: IvsVideoMonitor.StopReceiveVideo({0}).", cameraNo);
SmcErr err = new CgwError();
//需要停止的预览句柄
int needToStopHandel = CgwConst.START_RECEIVE_VIDEO_DATA_FAILED;
if (this.handelOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
if (this.cameraVideoHandeDic.ContainsKey(cameraNo))
{
needToStopHandel = this.cameraVideoHandeDic[cameraNo];
this.videoHandleCameraDic.Remove(needToStopHandel);
this.cameraVideoHandeDic.Remove(cameraNo);
}
else
{
logEx.Warn("Stop Receive camera video data failed. Don't need to end the preview.Camera No:{0}.", cameraNo);
//如果预览句柄不存在,不需要处理,直接返回
return err;
}
}
catch (Exception ex)
{
err.SetErrorNo(CgwError.STOP_RECEIVE_VIDEO_FAILED);
logEx.Error("Stop Receive camera video data failed.Execption message:{0}", ex.Message);
return err;
}
finally
{
this.handelOperateLock.ExitWriteLock();
}
}
//调用sdk的停止方法,放在handelOperateLock外面,防止长时间占用锁
if (needToStopHandel != CgwConst.START_RECEIVE_VIDEO_DATA_FAILED)
{
int result = this.ivsSdkClient.StopRealPlay(needToStopHandel);
//如果不为0,表示预览失败
if (result != CgwConst.IVS_SDK_SUCCESS_TAG)
{
err.SetErrorNo(CgwError.STOP_RECEIVE_VIDEO_FAILED);
logEx.Error("Stop Receive camera video data failed.Ivs sdk error code:{0}", result);
return err;
}
logEx.Info("Stop Receive camera video data success.Camera No:{0},Handle:{1}.", cameraNo, needToStopHandel);
}
return err;
}
示例14: StopControlPtz
/// <summary>
/// 停止云台控制,摄像头控制
/// </summary>
/// <param name="cameraNo">摄像头编号</param>
/// <param name="ptzCommand">命令类型</param>
/// <returns></returns>
public SmcErr StopControlPtz(string cameraNo, PtzCommandType ptzCommand)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: IvsVideoMonitor.StopControlPtz({0}).", cameraNo);
SmcErr err = new CgwError();
logEx.Trace("Call ivsSdkClient.StopPtzControl({0}).", cameraNo);
int result = this.ivsSdkClient.StopPtzControl(cameraNo);
//如果为0,表示成功
if (result == CgwConst.IVS_SDK_SUCCESS_TAG)
{
logEx.Info("Stop control ptz success.Camera No:{0}.", cameraNo);
}
else
{
//直接将IVS的错误码返回
err.SetErrorNo(CgwError.STOP_CONTROL_PTZ_FAILED);
logEx.Error("Stop control ptz failed.Camera No:{0}.Ivs sdk error code:{1}.", cameraNo, result);
return err;
}
return err;
}
示例15: StartReceiveVideo
/// <summary>
/// 启动摄像头预览
/// </summary>
/// <param name="cameraNo">摄像头编号</param>
/// <returns></returns>
public SmcErr StartReceiveVideo(string cameraNo)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: IvsVideoMonitor.StartReceiveVideo({0}).", cameraNo);
SmcErr err = new CgwError();
int handle;
logEx.Trace("Call ivsSdkClient.StartRealPlayCBRaw({0}).", cameraNo);
int result = this.ivsSdkClient.StartRealPlayCBRaw(cameraNo, out handle);
//如果不为0,表示预览失败
if (result != CgwConst.IVS_SDK_SUCCESS_TAG)
{
err.SetErrorNo(CgwError.START_RECEIVE_VIDEO_FAILED);
logEx.Error("Start Receive camera video data failed.Camera No:{0}.Ivs sdk error code:{1}", cameraNo, result);
return err;
}
else
{
logEx.Info("Start Receive camera video data success.Camera No:{0},Handle:{1}.", cameraNo, handle);
}
//预览成功,需要停止原来的预览,并将预览句柄添加到缓存
//需要停止的预览句柄
int needToStopHandel = CgwConst.START_RECEIVE_VIDEO_DATA_FAILED;
if (this.handelOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
//如果预览句柄已经存在,删除掉原来的句柄,用新的句柄替换
if (this.cameraVideoHandeDic.ContainsKey(cameraNo))
{
needToStopHandel = this.cameraVideoHandeDic[cameraNo];
this.videoHandleCameraDic.Remove(needToStopHandel);
this.cameraVideoHandeDic.Remove(cameraNo);
}
this.cameraVideoHandeDic.Add(cameraNo, handle);
MediaDataSender mediaDataSender = new MediaDataSender(cameraNo, this.dataCallBack);
this.videoHandleCameraDic.Add(handle, mediaDataSender);
}
finally
{
this.handelOperateLock.ExitWriteLock();
}
}
//重新预览后,更新了预览句柄,需要将原来的预览停止,放在handelOperateLock外面,防止长时间占用锁
if (needToStopHandel != CgwConst.START_RECEIVE_VIDEO_DATA_FAILED)
{
result = this.ivsSdkClient.StopRealPlay(needToStopHandel);
//如果不为0,表示停止原来的预览失败,只记录日志,不返回错误,不设置错误码
if (result != CgwConst.IVS_SDK_SUCCESS_TAG)
{
logEx.Error("Get a new preview success. But stop old preview failed.CameraNo:{0},Ivs sdk error code:{0}", cameraNo, result);
return err;
}
}
return err;
}