本文整理汇总了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);
}
});
}
示例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));
});
}
示例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);
}
示例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();
}
示例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);
}
}