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); } }); }
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(); }