/// <summary> /// Sends the contents of the buffer. /// </summary> /// <param name="firstLoggingEvent">The first logging event.</param> /// <param name="buffer">The buffer containing the events that need to be send.</param> /// <remarks> /// <para> /// The subclass must override <see cref="SendBuffer(LoggingEvent[])"/>. /// </para> /// </remarks> virtual protected void SendFromBuffer(LoggingEvent firstLoggingEvent, CyclicBuffer buffer) { LoggingEvent[] bufferEvents = buffer.PopAll(); if (firstLoggingEvent == null) { SendBuffer(bufferEvents); } else if (bufferEvents.Length == 0) { SendBuffer(new LoggingEvent[] { firstLoggingEvent }); } else { // Create new array with the firstLoggingEvent at the head LoggingEvent[] events = new LoggingEvent[bufferEvents.Length + 1]; Array.Copy(bufferEvents, 0, events, 1, bufferEvents.Length); events[0] = firstLoggingEvent; SendBuffer(events); } }