當前位置: 首頁>>代碼示例>>C#>>正文


C# LoggingEvent.Where方法代碼示例

本文整理匯總了C#中log4net.Core.LoggingEvent.Where方法的典型用法代碼示例。如果您正苦於以下問題:C# LoggingEvent.Where方法的具體用法?C# LoggingEvent.Where怎麽用?C# LoggingEvent.Where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在log4net.Core.LoggingEvent的用法示例。


在下文中一共展示了LoggingEvent.Where方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SendBuffer

        protected override async void SendBuffer(LoggingEvent[] events)
        {
            if (events == null || !events.Any())
            {
                return;
            }

            CheckSession();

            var logsEvents = events.Where(e => e != null).Select(e => new Log(e));

            await Task.Run(() =>
            {
                try
                {
                    Parallel.ForEach(logsEvents, (entry) =>
                    {
                        documentSession.Store(entry);
                    });
                    documentSession.SaveChanges();

                }
                catch (Exception e)
                {
                    ErrorHandler.Error("Exception while commiting to the Raven DB", e, ErrorCode.GenericFailure);
                }
            });

        }
開發者ID:antonsamarsky,項目名稱:log4net.Raven,代碼行數:29,代碼來源:RavenAppender.cs

示例2: Append

 protected override void Append(LoggingEvent[] loggingEvents)
 {
     var collection = GetCollection(CollectionName);
     IMongoCollection<BsonDocument> dualCollection = null;
     if (!string.IsNullOrWhiteSpace(DualCollectionName))
     {
         dualCollection = GetCollection(DualCollectionName);
     }
     Task.Run(() =>
     {
         collection.InsertManyAsync(loggingEvents.Select(BuildBsonDocument));
         dualCollection?.InsertManyAsync(
             loggingEvents.Where(log => log.Level >= DualCollectionLevelThreshold).Select(BuildBsonDocument));
     });
 }
開發者ID:carmbrester,項目名稱:Charm.Logging,代碼行數:15,代碼來源:MongoDBDualAppenderWithEx.cs

示例3: SendBuffer

        protected override void SendBuffer(LoggingEvent[] events)
        {
            var eventArray = events
                .Where(x => x.Level > Level.Debug)
                .Select(loggingEvent => new
                                 {
                                     agentName = Environment.MachineName,
                                     timestamp = loggingEvent.TimeStamp,
                                     time = loggingEvent.TimeStamp.ToString("hh:MM:ss"),
                                     level = loggingEvent.Level.ToString().ToLower(),
                                     message = loggingEvent.RenderedMessage,
                                     exception = loggingEvent.ExceptionObject != null ? loggingEvent.GetExceptionString() : null
                                 }).ToArray();

            _nodeFrontPublisherPublisher.Notify("/agent/log", eventArray);
        }
開發者ID:Fodsuk,項目名稱:asimov-deploy,代碼行數:16,代碼來源:NodeFrontLogAppender.cs

示例4: SendBuffer

		protected override void SendBuffer(LoggingEvent[] events)
		{
			if (events == null || !events.Any())
			{
				return;
			}

			this.CheckSession();

			foreach (var entry in events.Where(e => e != null).Select(e => new Log(e)))
			{
				this.documentSession.Store(entry);
			}

			this.Commit();
		}
開發者ID:coejouch,項目名稱:log4net.Raven,代碼行數:16,代碼來源:RavenAppender.cs

示例5: DoAppend

        /// <summary>
        /// Does the append.
        /// </summary>
        /// <param name="loggingEvents">The logging events.</param>
        public void DoAppend(LoggingEvent[] loggingEvents)
        {
            if (_stopForwarding)
            {
                ErrorHandler.Error(string.Concat("Attempted to append to closed appender named [", Name, "]."));
                return;
            }

            try
            {
                var filteredEvents = new List<LoggingEvent>(loggingEvents.Length);

                foreach (LoggingEvent loggingEvent in loggingEvents.Where(FilterEvent))
                {
                    loggingEvent.Fix = _fixedFields;
                    filteredEvents.Add(loggingEvent);
                }

                if (filteredEvents.Count == 0)
                    return;

                lock (_queueSynchro)
                {
                    if (_eventQueue.Count == 0)
                        Monitor.Pulse(_queueSynchro);
                    _eventQueue.AddRange(filteredEvents);
                    if (Interlocked.Add(ref _logEventsCounter, filteredEvents.Count) >=
                        StopEnqueuingLogEventsThreshold &&
                        StopEnqueuingLogEventsThreshold != 0)
                    {
                        _discardLogEvents = true;
                        LogLog.Warn("Queue is full, Events logged after this will be discarded.");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Error("Failed in Bulk DoAppend", ex);
            }
        }
開發者ID:lamiomni,項目名稱:questionyourfriends,代碼行數:44,代碼來源:QyfAsyncAppender.cs


注:本文中的log4net.Core.LoggingEvent.Where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。