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


C# ILogFactory.Create方法代码示例

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


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

示例1: HttpServer

 public HttpServer(ILogFactory logFactory, IServiceLocator locator)
 {
     Logger = logFactory.Create("Http server");
     Listener = new HttpListener();
     Listener.IgnoreWriteExceptions = true;
     foreach (string key in ConfigurationManager.AppSettings.Keys)
     {
         if (key.StartsWith("HttpAddress", StringComparison.InvariantCultureIgnoreCase))
             Listener.Prefixes.Add(ConfigurationManager.AppSettings[key]);
     }
     if (Listener.Prefixes.Count == 0)
     {
         Listener.Prefixes.Add("http://*:80/");
         Listener.Prefixes.Add("https://*:443/");
     }
     Routes = new Routes(locator);
     var customAuth = ConfigurationManager.AppSettings["CustomAuth"];
     if (!string.IsNullOrEmpty(customAuth))
     {
         var authType = Type.GetType(customAuth);
         if (!typeof(HttpAuth).IsAssignableFrom(authType))
             throw new ConfigurationErrorsException("Custom auth does not inherit from HttpAuth. Please inherit from " + typeof(HttpAuth).FullName);
         Authentication = locator.Resolve<HttpAuth>(authType);
     }
     else Authentication = locator.Resolve<HttpAuth>();
 }
开发者ID:nutrija,项目名称:revenj,代码行数:26,代码来源:HttpServer.cs

示例2: HeartBeatWorker

        /// <summary>
        /// Initializes a new instance of the <see cref="HeartBeatWorker" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="context">The context.</param>
        /// <param name="sendHeartBeat">The send heart beat.</param>
        /// <param name="threadPool">The thread pool.</param>
        /// <param name="log">The log.</param>
        /// <param name="heartBeatNotificationFactory">The heart beat notification factory.</param>
        public HeartBeatWorker(IHeartBeatConfiguration configuration, 
            IMessageContext context,
            ISendHeartBeat sendHeartBeat,
            IHeartBeatThreadPool threadPool,
            ILogFactory log,
            IWorkerHeartBeatNotificationFactory heartBeatNotificationFactory)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => context, context);
            Guard.NotNull(() => sendHeartBeat, sendHeartBeat);
            Guard.NotNull(() => threadPool, threadPool);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => heartBeatNotificationFactory, heartBeatNotificationFactory);

            _context = context;
            _checkTimespan = configuration.CheckTime;
            _sendHeartbeat = sendHeartBeat;
            _smartThreadPool = threadPool;
            _logger = log.Create();

            _runningLock = new ReaderWriterLockSlim();
            _stoppedLock = new ReaderWriterLockSlim();

            _cancel = new CancellationTokenSource();
            context.WorkerNotification.HeartBeat = heartBeatNotificationFactory.Create(_cancel.Token);
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:35,代码来源:HeartBeatWorker.cs

示例3: BaseQueue

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseQueue" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        protected BaseQueue(ILogFactory log)
        {
            Guard.NotNull(() => log, log);

            Log = log.Create();
            _startedLocker = new ReaderWriterLockSlim();
            _shouldWorkLocker = new ReaderWriterLockSlim();
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:12,代码来源:BaseQueue.cs

示例4: MessageExceptionHandler

 /// <summary>
 /// Initializes a new instance of the <see cref="MessageExceptionHandler"/> class.
 /// </summary>
 /// <param name="transportErrorHandler">The transport error handler.</param>
 /// <param name="log">The log.</param>
 public MessageExceptionHandler(IReceiveMessagesError transportErrorHandler, 
     ILogFactory log)
 {
     Guard.NotNull(() => transportErrorHandler, transportErrorHandler);
     Guard.NotNull(() => log, log);
     _transportErrorHandler = transportErrorHandler;
     _log = log.Create();
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:13,代码来源:MessageExceptionHandler.cs

示例5: Session

        public Session(
            IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID)
        {
            this.Application = app;
            this.SessionID = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_ = sessionSchedule;
            this.msgFactory_ = msgFactory;

            this.SenderDefaultApplVerID = senderDefaultApplVerID;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            else
                this.ApplicationDataDictionary = this.SessionDataDictionary;

            ILog log;
            if (null != logFactory)
                log = logFactory.Create(sessID);
            else
                log = new NullLog();

            state_ = new SessionState(log, heartBtInt)
            {
                MessageStore = storeFactory.Create(sessID)
            };

            // Configuration defaults.
            // Will be overridden by the SessionFactory with values in the user's configuration.
            this.PersistMessages = true;
            this.ResetOnDisconnect = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum = true;
            this.CheckCompID = true;
            this.MillisecondsInTimeStamp = true;
            this.EnableLastMsgSeqNumProcessed = false;
            this.MaxMessagesInResendRequest = 0;
            this.SendLogoutBeforeTimeoutDisconnect = false;
            this.IgnorePossDupResendRequests = false;
            this.RequiresOrigSendingTime = true;
            this.CheckLatency = true;
            this.MaxLatency = 120;

            if (!IsSessionTime)
                Reset("Out of SessionTime (Session construction)");
            else if (IsNewSession)
                Reset("New session");

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
开发者ID:huruixd,项目名称:quickfixn,代码行数:58,代码来源:Session.cs

示例6: DelayedProcessingActionDecorator

        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessageQueryDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="handler">The handler.</param>
        public DelayedProcessingActionDecorator(ILogFactory log,
            IDelayedProcessingAction handler)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);

            _log = log.Create();
            _handler = handler;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:14,代码来源:DelayedProcessingActionDecorator.cs

示例7: ReceivePoisonMessageDecorator

        /// <summary>
        /// Initializes a new instance of the <see cref="ReceivePoisonMessageDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="handler">The handler.</param>
        public ReceivePoisonMessageDecorator(ILogFactory log,
            IReceivePoisonMessage handler)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);

            _log = log.Create();
            _handler = handler;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:14,代码来源:IReceivePoisonMessageDecorator.cs

示例8: BaseTime

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseTime" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="configuration">The configuration.</param>
        protected BaseTime(ILogFactory log,
            BaseTimeConfiguration configuration)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => configuration, configuration);

            Configuration = configuration;
            Log = log.Create();
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:14,代码来源:BaseTime.cs

示例9: ClearExpiredMessagesDecorator

        /// <summary>
        /// Initializes a new instance of the <see cref="ClearExpiredMessagesDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInfo">The connection information.</param>
        public ClearExpiredMessagesDecorator(ILogFactory log,
            IClearExpiredMessages handler, 
            IConnectionInformation connectionInfo)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);
            Guard.NotNull(() => connectionInfo, connectionInfo);

            _log = log.Create();
            _handler = handler;
            _connectionInfo = connectionInfo;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:18,代码来源:IClearExpiredMessagesDecorator.cs

示例10: BeginTransactionRetryDecorator

        public BeginTransactionRetryDecorator(ISqLiteTransactionWrapper decorated,
            ILogFactory log,
            ThreadSafeRandom threadSafeRandom)
        {
            Guard.NotNull(() => decorated, decorated);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => threadSafeRandom, threadSafeRandom);

            _decorated = decorated;
            _log = log.Create();
            _threadSafeRandom = threadSafeRandom;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:12,代码来源:BeginTransactionRetryDecorator.cs

示例11: BaseMonitor

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMonitor" /> class.
        /// </summary>
        /// <param name="monitorAction">The monitor action.</param>
        /// <param name="monitorTimeSpan">The monitor time span.</param>
        /// <param name="log">The log.</param>
        protected BaseMonitor(Func<CancellationToken, long> monitorAction, 
            IMonitorTimespan monitorTimeSpan,
            ILogFactory log)
        {
            Guard.NotNull(() => monitorAction, monitorAction);
            Guard.NotNull(() => monitorTimeSpan, monitorTimeSpan);
            Guard.NotNull(() => log, log);

            _monitorAction = monitorAction;
            _monitorTimeSpan = monitorTimeSpan;
            _log = log.Create();
            _runningLock = new ReaderWriterLockSlim();
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:19,代码来源:BaseMonitor.cs

示例12: QueueStatusHttp

 /// <summary>
 /// Initializes a new instance of the <see cref="QueueStatusHttp"/> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="additionalConfiguration">The additional configuration.</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="log">The log.</param>
 public QueueStatusHttp(
     QueueStatusHttpConfiguration configuration,
     IConfiguration additionalConfiguration,
     IInternalSerializer serializer,
     ILogFactory log)
 {
     _log = log.Create();
     _configuration = configuration;
     _serializer = serializer;
     Configuration = additionalConfiguration;
     _queueStatusProviders = new ConcurrentBag<IQueueStatusProvider>();
     Configuration.SetSetting("QueueStatusHttpConfiguration", _configuration);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:20,代码来源:QueueStatusHttp.cs

示例13: ProducerMethodJobQueue

        /// <summary>
        /// Initializes a new instance of the <see cref="ProducerMethodJobQueue" /> class.
        /// </summary>
        /// <param name="jobSchedulerLastKnownEvent">The job scheduler last known event.</param>
        /// <param name="sendJobToQueue">The send job to queue.</param>
        /// <param name="logFactory">The log factory.</param>
        /// <param name="createJobQueue">The create job queue.</param>
        public ProducerMethodJobQueue(IJobSchedulerLastKnownEvent jobSchedulerLastKnownEvent,
            ISendJobToQueue sendJobToQueue,
            ILogFactory logFactory,
            IJobTableCreation createJobQueue)
        {
            Guard.NotNull(() => jobSchedulerLastKnownEvent, jobSchedulerLastKnownEvent);
            Guard.NotNull(() => sendJobToQueue, sendJobToQueue);
            Guard.NotNull(() => logFactory, logFactory);
            Guard.NotNull(() => createJobQueue, createJobQueue);

            LastKnownEvent = jobSchedulerLastKnownEvent;
            _sendJobToQueue = sendJobToQueue;
            Logger = logFactory.Create();
            _createJobQueue = createJobQueue;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:22,代码来源:ProducerMethodJobQueue.cs

示例14: PostgresConnectionPool

 public PostgresConnectionPool(ConnectionInfo info, ILogFactory logFactory)
 {
     this.Info = info;
     if (!int.TryParse(ConfigurationManager.AppSettings["Database.PoolSize"], out Size))
         Size = 20;
     if (!Enum.TryParse<PoolMode>(ConfigurationManager.AppSettings["Database.PoolMode"], out Mode))
         Mode = PoolMode.IfAvailable;
     if (Mode != PoolMode.None)
     {
         if (Size < 1) Size = 1;
         for (int i = 0; i < Size; i++)
             Connections.Add(info.GetConnection());
     }
     this.Logger = logFactory.Create("Npgsql connection manager");
 }
开发者ID:rinmalavi,项目名称:revenj,代码行数:15,代码来源:PostgresConnectionPool.cs

示例15: AbortWorkerThreadDecorator

        /// <summary>
        /// Initializes a new instance of the <see cref="AbortWorkerThreadDecorator" /> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="messageMode">The message mode.</param>
        /// <param name="handler">The handler.</param>
        public AbortWorkerThreadDecorator(ILogFactory log,
            IWorkerConfiguration configuration,
            MessageProcessingMode messageMode,
            IAbortWorkerThread handler)
        {
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => handler, handler);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => messageMode, messageMode);

            _log = log.Create();
            _handler = handler;
            _configuration = configuration;
            _messageMode = messageMode;
        }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:22,代码来源:IAbortWorkerThreadDecorator.cs


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