Beispiel #1
0
        void IPerRequestLogger.Complete(string requestId)
        {
            PerRequestLogBuffer logBuffer = null;

            if (_buffers.TryGetValue(requestId, out logBuffer))
            {
                CompleteAndRemove(requestId, logBuffer);
            }
        }
Beispiel #2
0
        void IFlushPerRequestLogs.Flush(string requestId, Func <LogEvent, bool> filter)
        {
            PerRequestLogBuffer logBuffer = null;

            if (_buffers.TryGetValue(requestId, out logBuffer))
            {
                logBuffer.Flush(filter);
            }
        }
Beispiel #3
0
 private void CompleteAndRemove(string requestId, PerRequestLogBuffer logBuffer)
 {
     try
     {
         logBuffer.Complete();
     }
     finally
     {
         lock (_buffers)
         {
             _buffers.Remove(requestId);
         }
     }
 }
Beispiel #4
0
        private PerRequestLogBuffer GetOrCreateRequestBuffer(string requestId)
        {
            PerRequestLogBuffer logBuffer = null;

            if (!_buffers.TryGetValue(requestId, out logBuffer))
            {
                lock (_buffers)
                {
                    if (!_buffers.TryGetValue(requestId, out logBuffer))
                    {
                        logBuffer = new PerRequestLogBuffer(DefaultBufferCapacity, _eventLevel, _allEventLevel, _sink);
                        _buffers.Add(requestId, logBuffer);
                    }
                }
            }
            return(logBuffer);
        }