当前位置: 首页>>代码示例>>C#>>正文


C# ILogger.InfoFormat方法代码示例

本文整理汇总了C#中ILogger.InfoFormat方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.InfoFormat方法的具体用法?C# ILogger.InfoFormat怎么用?C# ILogger.InfoFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogger的用法示例。


在下文中一共展示了ILogger.InfoFormat方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssemblyConfiguration

 protected AssemblyConfiguration(Dictionary<string, object> defaultValues, ILogger logger)
 {
     NameValueCollection nameValues = ConfigurationManager.AppSettings;
     CreateConfiguration(defaultValues, nameValues);
     foreach (KeyValuePair<string, string> pair in UsedValues)
         logger.InfoFormat("Using {0}={1}", pair.Key, pair.Value);
 }
开发者ID:EDOlsson,项目名称:White,代码行数:7,代码来源:AssemblyConfiguration.cs

示例2: InitializeECommon

        static void InitializeECommon()
        {
            _message = new byte[int.Parse(ConfigurationManager.AppSettings["MessageSize"])];
            _mode = ConfigurationManager.AppSettings["Mode"];
            _messageCount = int.Parse(ConfigurationManager.AppSettings["MessageCount"]);

            var logContextText = "mode: " + _mode;

            ECommonConfiguration
                .Create()
                .UseAutofac()
                .RegisterCommonComponents()
                .UseLog4Net()
                .RegisterUnhandledExceptionHandler();

            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(typeof(Program).Name);
            _performanceService = ObjectContainer.Resolve<IPerformanceService>();
            var setting = new PerformanceServiceSetting
            {
                AutoLogging = false,
                StatIntervalSeconds = 1,
                PerformanceInfoHandler = x =>
                {
                    _logger.InfoFormat("{0}, {1}, totalCount: {2}, throughput: {3}, averageThrughput: {4}, rt: {5:F3}ms, averageRT: {6:F3}ms", _performanceService.Name, logContextText, x.TotalCount, x.Throughput, x.AverageThroughput, x.RT, x.AverageRT);
                }
            };
            _performanceService.Initialize(_performanceKey, setting);
            _performanceService.Start();
        }
开发者ID:Aaron-Liu,项目名称:ecommon,代码行数:29,代码来源:Program.cs

示例3: LogElapsedTime

 /// <summary>
 /// The log elapsed time.
 /// </summary>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="prefix">
 /// The prefix.
 /// </param>
 /// <param name="elapsedTime">
 /// The elapsed time.
 /// </param>
 /// <param name="numItems">
 /// The num items.
 /// </param>
 protected void LogElapsedTime(ILogger logger, string prefix, TimeSpan elapsedTime, long numItems)
 {
     if (logger.IsInfoEnabled)
     {
         logger.InfoFormat(
             "{0}{1,10:N2} ms = {2,10:N5} ms/item = {3,10:N0} items/s", 
             prefix, 
             elapsedTime.TotalMilliseconds, 
             elapsedTime.TotalMilliseconds / numItems, 
             1000.0 / elapsedTime.TotalMilliseconds * numItems);
     }
 }
开发者ID:ommziSolution,项目名称:PhotonServer,代码行数:27,代码来源:TcpTestsBase.cs

示例4: WaitForAllHttpRequestsToEnd

 public static void WaitForAllHttpRequestsToEnd(ILogger logger)
 {
     // http://blogs.msdn.com/b/windowsazure/archive/2013/01/14/the-right-way-to-handle-azure-onstop-events.aspx
     var pcrc = new PerformanceCounter("ASP.NET", "Requests Current", "");
     while (true)
     {
         var rc = pcrc.NextValue();
         logger.InfoFormat("ASP.NET Requests Current = {0}, {1}.", rc, rc <= 0 ? "permitting role exit" : "blocking role exit");
         if (rc <= 0)
             break;
         Thread.Sleep(TimeSpan.FromSeconds(1));
     }
 }
开发者ID:MRCollective,项目名称:AzureWebFarm,代码行数:13,代码来源:DiagnosticsHelper.cs

示例5: Watcher

        public Watcher(string sourcePath, string destinationPath, string filter, ILogger<Watcher> logger)
        {
            _logger = logger;
            SourcePath = sourcePath;
            DestinationPath = destinationPath;
            _filter = filter;

            _watcher = new FileSystemWatcher(sourcePath, filter);
            _watcher.NotifyFilter = NotifyFilters.LastWrite;
            _watcher.Changed += Move;
            _watcher.EnableRaisingEvents = true;

            _logger.InfoFormat("Watching {0} on {1} to copy to {2}", _sourcePath, _filter, _destinationPath);
        }
开发者ID:code-attic,项目名称:theCopyGuy,代码行数:14,代码来源:Watcher.cs

示例6: RequestHandler

 public RequestHandler()
 {
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _performanceService = ObjectContainer.Resolve<IPerformanceService>();
     var setting = new PerformanceServiceSetting
     {
         AutoLogging = false,
         StatIntervalSeconds = 1,
         PerformanceInfoHandler = x =>
         {
             _logger.InfoFormat("{0}, totalCount: {1}, throughput: {2}, averageThrughput: {3}, rt: {4:F3}ms, averageRT: {5:F3}ms", _performanceService.Name, x.TotalCount, x.Throughput, x.AverageThroughput, x.RT, x.AverageRT);
         }
     };
     _performanceService.Initialize(_performanceKey, setting);
     _performanceService.Start();
 }
开发者ID:Aaron-Liu,项目名称:ecommon,代码行数:16,代码来源:Program.cs

示例7: ProcessResult

        public void ProcessResult(RawMessage message, ITransport transport, ILogger log)
        {
            if (WillRetry(message.RetryCount))
            {
                message.RetryCount++;
                log.InfoFormat("Message requested to be retried {0} - Retry Count {1}", message.ToString(), message.RetryCount);

                // Exponential backoff with a 90% - 110% jitter added to avoid synchronized backoffs on failures.
                var delayTime = TimeSpan.FromMilliseconds((Math.Pow(4, message.RetryCount) * 100) * (1.0 + (new Random().NextDouble() - 0.5) / 5));
                message.RetryCount = message.RetryCount;

                // Convert to a delay result and process
                var delayResult = new DelayResult(DateTime.UtcNow.Add(delayTime));
                delayResult.ProcessResult(message, transport, log);
            }
            else
            {
                // Out of retries, convert to a fail result
                var failResult = new FailResult(this.Message);
                failResult.ProcessResult(message, transport, log);
            }
        }
开发者ID:ExpediaInc,项目名称:WaveServiceBus,代码行数:22,代码来源:RetryResult.cs

示例8: Start

        public void Start(string[] args)
        {
            _sw.Start();
            var configuration = ConfigurationManager.OpenExeConfiguration("Cdev.Spartan.Sevice.Manager.exe");
            var section = configuration.GetSection("gps") as GpsSectionConfig;
            if (section == null)
            {
                throw new NullReferenceException("配置错误!找不到配置节点 gps");
            }
            var config = section.Gateways.FirstOrDefault(p => p.Name.ToLower() == args[0].ToLower());
            if (config == null)
            {
                throw new NullReferenceException("配置错误!找不到任何网关配置");
            }

           
            var logConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net", config.Name.ToLower() + ".config");
            if (!File.Exists(logConfigPath))
            {
                var text = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net", "log4net.config"));
                text = text.Replace(@"log\main\", @"log\" + config.Name.ToLower() + @"\");
                File.WriteAllText(logConfigPath, text);
            }
            _logger = new Log4NetLogger(logConfigPath);
            _sw.Stop();
            _logger.InfoFormat("加载配置信息[{0}毫秒]!", _sw.ElapsedMilliseconds);
            _sw.Restart();

            try
            {
                DMContext.SetConnectionString(configuration.ConnectionStrings.ConnectionStrings["DefaultConnectionString"].ConnectionString);
                CdevContainer.Ins.SetContainer(new UnityObjectContainer());

                _server = new DefaultAppSocketTcpServer(config.Host, config.Port, config.BufferSize, config.MaxConnect,CdevContainer.Ins.Container, (c) =>
                {
                        #region 注入基础服务

                        CdevContainer.Ins.RegisterInstance(_logger);
#if DEBUG
                        CdevContainer.Ins.RegisterInstance<IRawDataService>(new RawDataService(config.RawDataSavePath, 1));
#else
                        CdevContainer.Ins.RegisterInstance<IRawDataService>(new RawDataService(config.RawDataSavePath));
#endif
                        CdevContainer.Ins.RegisterType<IRepository, Repository>();
                        CdevContainer.Ins.RegisterType<ICacheService, CacheService>();
                        CdevContainer.Ins.RegisterType<IConfigService, ConfigService>();
                        CdevContainer.Ins.RegisterType<IStateService, StateService>();
                        CdevContainer.Ins.RegisterType<ISmsService, SmsService>();
                        CdevContainer.Ins.RegisterType<IEmailService, EmailService>();
                        CdevContainer.Ins.RegisterType<IUserService, UserService>();
                        CdevContainer.Ins.RegisterType<IMapService, MapService>();
                        _sw.Stop();
                        _logger.InfoFormat("加载基础服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                        _sw.Restart();
                        #endregion 注入基础服务

                        #region 注入核心服务
                        CdevContainer.Ins.RegisterType<INodeService, NodeService>();
                        CdevContainer.Ins.RegisterType<IMileageService, MileageService>();
                        CdevContainer.Ins.RegisterType<IDeviceGroupService, DeviceGroupService>();
                        CdevContainer.Ins.RegisterType<IDeviceService, DeviceService>();
                        CdevContainer.Ins.RegisterType<IPositionService, PositionService>();
                        CdevContainer.Ins.RegisterType<IQueueService, QueueService>();
                        _sw.Stop();
                        _logger.InfoFormat("加载核心服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                        _sw.Restart();

                        //指令
                        CdevContainer.Ins.RegisterType<IInstructionHandler, Gt06InstructionHandler>();
                        CdevContainer.Ins.RegisterInstance<IInstructionReceiveService>(new InstructionReceiveService(config.Name));
                        CdevContainer.Ins.RegisterType<IInstructionService, InstructionService>();

                        //处理器
                        CdevContainer.Ins.RegisterType<IAppSocketProtocol, Gt06Protocol>();
                        CdevContainer.Ins.RegisterType<IAppSocketServerEvent, Gt06ServerEvent>();
            
                        _sw.Stop();
                        _logger.InfoFormat("加载核心服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                        _sw.Restart();
                        #endregion 注入核心服务

                        #region 加载缓存数据
                        //加载设备数据
                        CdevContainer.Ins.Resolve<IDeviceService>().LoadAllDeviceByDeviceGpsCodeToCache();
                        _sw.Stop();
                        _logger.InfoFormat("加载缓存数据[{0}毫秒]!", _sw.ElapsedMilliseconds);
                        _sw.Restart();
                        #endregion

                        #region 注入队列

                        if ("all".Equals(config.Queue.ToLower()))
                        {
                            foreach (var queueConfig in section.Queues)
                            {
                                CdevContainer.Ins.RegisterInstance<ISendQueue>(queueConfig.Name,new DefaultSendQueue(queueConfig.Name, queueConfig.Uri), IOCLife.Singleton);
                            }
                        }
                        else
                        {
//.........这里部分代码省略.........
开发者ID:hhahh2011,项目名称:CH.Spartan,代码行数:101,代码来源:Gt06Entry.cs

示例9: CheckMonoVersion

      private static bool CheckMonoVersion(ILogger logger)
      {
         // check for Mono runtime
         if (!Core.Application.IsRunningOnMono)
         {
            return true;
         }

         Version monoVersion = null;
         try
         {
            monoVersion = Core.Application.GetMonoVersionNumer();
         }
         catch (Exception ex)
         {
            logger.Warn(Properties.Resources.MonoDetectFailed, ex);
         }

         if (monoVersion != null)
         {
            if (monoVersion.Major < 2 || (monoVersion.Major == 2 && monoVersion.Minor < 8))
            {
               var ex = new InvalidOperationException(Properties.Resources.MonoTooOld);
               ShowStartupError(ex);
               return false;
            }
            logger.InfoFormat("Running on Mono v{0}...", monoVersion);
         }
         else
         {
            logger.Info("Running on Mono...");
         }
         return true;
      }
开发者ID:harlam357,项目名称:hfm-net,代码行数:34,代码来源:BootStrapper.cs

示例10: Start

        public void Start(string[] args)
        {
            _sw.Start();
            var configuration = ConfigurationManager.OpenExeConfiguration("Cdev.Spartan.Sevice.Manager.exe");
            var section = configuration.GetSection("gps") as GpsSectionConfig;
            if (section == null)
            {
                throw new NullReferenceException("配置错误!找不到配置节点 gps");
            }
            var config = section.Storages.FirstOrDefault(p => p.Name.ToLower() == args[0].ToLower());
            if (config == null)
            {
                throw new NullReferenceException("配置错误!找不到任何存储配置");
            }
            var logConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net", config.Name.ToLower() + ".config");
            if (!File.Exists(logConfigPath))
            {
                var text = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net", "log4net.config"));
                text = text.Replace(@"log\main\", @"log\" + config.Name.ToLower() + @"\");
                File.WriteAllText(logConfigPath, text);
            }
            _logger = new Log4NetLogger(logConfigPath);
            _sw.Stop();
            _logger.InfoFormat("加载配置信息[{0}毫秒]!", _sw.ElapsedMilliseconds);
            _sw.Restart();
            try
            {
                DMContext.SetConnectionString(configuration.ConnectionStrings.ConnectionStrings["DefaultConnectionString"].ConnectionString);
                CdevContainer.Ins.SetContainer(new UnityObjectContainer());

                #region 注入基础服务

                CdevContainer.Ins.RegisterInstance(_logger);
                CdevContainer.Ins.RegisterType<IRepository, Repository>();
                CdevContainer.Ins.RegisterType<ICacheService, CacheService>();
                CdevContainer.Ins.RegisterType<IConfigService, ConfigService>();
                CdevContainer.Ins.RegisterType<IStateService, StateService>();
                CdevContainer.Ins.RegisterType<IUserService, UserService>();
                CdevContainer.Ins.RegisterType<IMapService, MapService>();
                CdevContainer.Ins.RegisterType<IAppSocketClient, DefaultAppTcpSocketClient>("DefaultAppTcpSocketClient", IOCLife.Transient);
                CdevContainer.Ins.RegisterType<IAppSocketClient, DefaultAppUdpSocketClient>("DefaultAppUdpSocketClient", IOCLife.Transient);
                _sw.Stop();
                _logger.InfoFormat("加载基础服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                _sw.Restart();
                #endregion 注入基础服务

                #region 注入核心服务
                CdevContainer.Ins.RegisterType<INodeService, NodeService>();
                CdevContainer.Ins.RegisterType<IMileageService, MileageService>();
                CdevContainer.Ins.RegisterType<IDeviceGroupService, DeviceGroupService>();
                CdevContainer.Ins.RegisterType<IDeviceService, DeviceService>();
                CdevContainer.Ins.RegisterType<IPositionService, PositionService>();
                _sw.Stop();
                _logger.InfoFormat("加载核心服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                _sw.Restart();
                #endregion 注入核心服务

                foreach (var handlerConfig in config.Handlers)
                {
                    var array = handlerConfig.Type.Split(',');
                    var handler = AssemblyHelper.GetAssemblyByName(array[1].Trim()).CreateInstance(array[0].Trim()) as AbstractForwardHandler;
                    if (handler == null) throw new NullReferenceException("没有找到转发处理器!{0}".GetFormat(handlerConfig.Name));
                    CdevContainer.Ins.RegisterInstance(handlerConfig.Name, handler, IOCLife.Transient);
                    handler.SetConfig(handlerConfig.Name);
                    handler.Start();
                    _handlers.Add(handler);

                }
                _sw.Stop();
                _logger.InfoFormat("加载处理器[{0}毫秒]!", _sw.ElapsedMilliseconds);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                return;
            }
            _logger.Info("开启转发数据服务成功!");

        }
开发者ID:hhahh2011,项目名称:CH.Spartan,代码行数:79,代码来源:ForwardEntry.cs

示例11: TcpConnection

        public TcpConnection(Socket socket, IBufferPool bufferPool, Action<ITcpConnection, byte[]> messageArrivedHandler, Action<ITcpConnection, SocketError> connectionClosedHandler)
        {
            Ensure.NotNull(socket, "socket");
            Ensure.NotNull(messageArrivedHandler, "messageArrivedHandler");
            Ensure.NotNull(connectionClosedHandler, "connectionClosedHandler");

            _socket = socket;
            _bufferPool = bufferPool;
            _localEndPoint = socket.LocalEndPoint;
            _remotingEndPoint = socket.RemoteEndPoint;
            _messageArrivedHandler = messageArrivedHandler;
            _connectionClosedHandler = connectionClosedHandler;

            _sendSocketArgsStack = new ConcurrentStack<SocketAsyncEventArgs>();

            for (var i = 0; i < 5; i++)
            {
                var sendSocketArgs = new SocketAsyncEventArgs();
                sendSocketArgs.AcceptSocket = socket;
                sendSocketArgs.Completed += OnSendAsyncCompleted;
                _sendSocketArgsStack.Push(sendSocketArgs);
            }

            _receiveSocketArgs = new SocketAsyncEventArgs();
            _receiveSocketArgs.AcceptSocket = socket;
            _receiveSocketArgs.Completed += OnReceiveAsyncCompleted;

            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);

            _framer = new LengthPrefixMessageFramer();
            _framer.RegisterMessageArrivedCallback(OnMessageArrived);

            _scheduleService.StartTask("PrintStreamBufferLength", () =>
            {
                _logger.InfoFormat("_sendingCount: {0}, _sentCount: {1}", _sendingCount, _sentCount);
            }, 1000, 1000);

            TryReceive();
            TrySend();
        }
开发者ID:geffzhang,项目名称:ecommon,代码行数:40,代码来源:TcpConnection.cs

示例12: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var assemblies = new Assembly[] {
                Assembly.Load("CooperDemo.Model"),
                Assembly.Load("CooperDemo.Repositories"),
                Assembly.Load("CooperDemo")
            };

            Configuration.Config()
                .SetResolver(new TinyIoCDependencyResolver())
                .RegisterDefaultComponents(assemblies);

            _logger = DependencyResolver.Resolve<ILoggerFactory>().Create(typeof(MainActivity));
            _taskFolderService = DependencyResolver.Resolve<ITaskFolderService>();

            SetContentView(Resource.Layout.Main);

            _listView = FindViewById<ListView>(Resource.Id.list);
            _listView.SetOnCreateContextMenuListener(this);

            Button button1 = FindViewById<Button>(Resource.Id.GetAllTaskFoldersButton);
            button1.Click += (sender, e) =>
            {
                SendGetAllTaskFoldersRequest();
            };

            SendLoginRequest();

            _logger.InfoFormat("Application '{0}' Started.", "Cooper");
        }
开发者ID:codesharp,项目名称:cooper,代码行数:32,代码来源:MainActivity.cs

示例13: Start

        public void Start(string[] args)
        {
            _sw.Start();
            var configuration = ConfigurationManager.OpenExeConfiguration("Cdev.Spartan.Sevice.Manager.exe");
            var section = configuration.GetSection("gps") as GpsSectionConfig;

            if (section == null)
            {
                throw new NullReferenceException("配置错误!找不到配置节点 gps");
            }
            var config = section.Storages.FirstOrDefault(p => p.Name.ToLower() == args[0].ToLower());
            if (config == null)
            {
                throw new NullReferenceException("配置错误!找不到任何存储配置");
            }

            
            var logConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net",config.Name.ToLower() + ".config");
            if (!File.Exists(logConfigPath))
            {
                var text =File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net", "log4net.config"));
                text = text.Replace(@"log\main\", @"log\" + config.Name.ToLower() + @"\");
                File.WriteAllText(logConfigPath, text);
            }
            _sw.Stop();
            _logger = new Log4NetLogger(logConfigPath);
            _logger.InfoFormat("加载配置信息[{0}毫秒]!", _sw.ElapsedMilliseconds);
            _sw.Restart();

            try
            {
                DMContext.SetConnectionString(configuration.ConnectionStrings.ConnectionStrings["DefaultConnectionString"].ConnectionString);
                CdevContainer.Ins.SetContainer(new UnityObjectContainer());

                #region 注入基础服务

                CdevContainer.Ins.RegisterInstance(_logger);
                CdevContainer.Ins.RegisterType<IRepository, Repository>();
                CdevContainer.Ins.RegisterType<ICacheService, CacheService>();
                CdevContainer.Ins.RegisterType<IConfigService, ConfigService>();
                CdevContainer.Ins.RegisterType<IStateService, StateService>();
                CdevContainer.Ins.RegisterType<ISmsService, SmsService>();
                CdevContainer.Ins.RegisterType<IEmailService, EmailService>();
                CdevContainer.Ins.RegisterType<IPushService, PushService>();
                CdevContainer.Ins.RegisterType<IUserService, UserService>();
                CdevContainer.Ins.RegisterType<IMapService, MapService>();
                CdevContainer.Ins.RegisterType<ISiteMessageService, SiteMessageService>();
                _sw.Stop();
                _logger.InfoFormat("加载基础服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                _sw.Restart();
                #endregion 注入基础服务

                #region 注入核心服务
                CdevContainer.Ins.RegisterType<INodeService, NodeService>();
                CdevContainer.Ins.RegisterType<IAreaService, AreaService>();
                CdevContainer.Ins.RegisterType<IDeviceGroupService, DeviceGroupService>();
                CdevContainer.Ins.RegisterType<IDeviceService, DeviceService>();
                CdevContainer.Ins.RegisterType<IPositionService, PositionService>();
                CdevContainer.Ins.RegisterType<IAlarmService, AlarmService>();
                _sw.Stop();
                _logger.InfoFormat("加载核心服务[{0}毫秒]!", _sw.ElapsedMilliseconds);
                _sw.Restart();
                #endregion 注入核心服务

                #region 加载缓存数据
                //加载区域数据
                CdevContainer.Ins.Resolve<IAreaService>().LoadAllAreaByIdToCache();
                //加载设备数据
                CdevContainer.Ins.Resolve<IDeviceService>().LoadAllDeviceByDeviceGpsCodeToCache();
                //加载报警数据
                CdevContainer.Ins.Resolve<IAlarmService>().LoadAllAlarmSettingByDeviceIdToCache();
                _sw.Stop();
                _logger.InfoFormat("加载缓存数据[{0}毫秒]!", _sw.ElapsedMilliseconds);
                _sw.Restart();
                #endregion

                foreach (var handlerConfig in config.Handlers)
                {
                    var array = handlerConfig.Type.Split(',');
                    var handler = AssemblyHelper.GetAssemblyByName(array[1].Trim()).CreateInstance(array[0].Trim()) as  AbstractAlarmHandler;
                    if (handler == null) throw new NullReferenceException("没有找到队里处理器!{0}".GetFormat(handlerConfig.Name));
                    CdevContainer.Ins.RegisterInstance(handlerConfig.Name, handler, IOCLife.Transient);

                    var queueConfig = section.Queues.FirstOrDefault(p => p.Name == handlerConfig.Queue);
                    if (queueConfig == null) throw new NullReferenceException("没有找到队列处理器的队列配置!{0},{1}".GetFormat(handlerConfig.Name, handlerConfig.Queue));

                    handler.SetPackageQueue(new DefaultReceiveQueue(queueConfig.Name, queueConfig.Uri));
                    handler.Start();
                    _handlers.Add(handler);
                }
                _sw.Stop();
                _logger.InfoFormat("加载处理器[{0}毫秒]!", _sw.ElapsedMilliseconds);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                return;
            }
            _logger.Info("开启报警服务成功!");
        }
开发者ID:hhahh2011,项目名称:CH.Spartan,代码行数:100,代码来源:AlarmEntry.cs


注:本文中的ILogger.InfoFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。