System.Collections.Concurrent.BlockingCollection.Add(Serilog.Events.LogEvent)

Here are the examples of the csharp api class System.Collections.Concurrent.BlockingCollection.Add(Serilog.Events.LogEvent) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: serilog-sinks-async
Source File: BackgroundWorkerSink.cs
public void Emit(LogEvent logEvent)
        {
            if (this._queue.IsAddingCompleted)
                return;

            try
            {
                if (_blockWhenFull)
                {
                    _queue.Add(logEvent);
                }
                else
                {
                    if (!_queue.TryAdd(logEvent))
                        SelfLog.WriteLine("{0} unable to enqueue, capacity {1}", typeof(BackgroundWorkerSink), _bufferCapacity);
                }
            }
            catch (InvalidOperationException)
            {
                // Thrown in the event of a race condition when we try to add another event after 
                // CompleteAdding has been called
            }
        }