当前位置: 首页>>代码示例>>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;未经允许,请勿转载。