/// <summary> /// Called when any message is written to the log. /// </summary> /// <param name="log">The log.</param> /// <param name="message">The message.</param> /// <param name="logEvent">The log event.</param> /// <param name="extraData">The additional data.</param> /// <param name="logData">The log data.</param> /// <param name="time">The time.</param> protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time) { var logEntry = new LogBatchEntry(log, message, logEvent, extraData, logData, time); lock (_lock) { _logBatch.Add(logEntry); if (_logBatch.Count >= MaximumBatchCount) { #pragma warning disable 4014 FlushAsync(); #pragma warning restore 4014 } } }
/// <summary> /// Called when any message is written to the log. /// </summary> /// <param name="log">The log.</param> /// <param name="message">The message.</param> /// <param name="logEvent">The log event.</param> /// <param name="extraData">The additional data.</param> /// <param name="logData">The log data.</param> /// <param name="time">The time.</param> protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time) { var logEntry = new LogBatchEntry(log, message, logEvent, extraData, logData, time); lock (_lock) { _logBatch.Add(logEntry); if (_logBatch.Count >= MaximumBatchCount) { // TODO: remove pragma in 5.0.0 #pragma warning disable 4014 Flush(); #pragma warning restore 4014 } } }