Example #1
0
        private Timer _timer = null;                                        //Used for sweeping the queue of messages


        /// <summary>
        /// Default constructor.  Start buffer sweep timer which will look through log queue and persist all pages of log messages is finds
        /// </summary>
        public AsyncBuffer()
        {
            _bufferSweepMs  = ConfigManager.AppSetting <int>("Logging.Default.BufferSweepMs", BUFFER_SWEEP_MS);
            _maxPageSize    = ConfigManager.AppSetting <int>("Logging.Default.MaxPageSize", MAX_PAGE_SIZE);
            _cacheTimeOutMs = ConfigManager.AppSetting <int>("Logging.Default.CacheTimeOutMs", CACHE_TIMEOUT_MS);

            _timer = new Timer(sweepQueue, null, _bufferSweepMs, _bufferSweepMs);
            _timer.Change(0, _bufferSweepMs);
            _bufferAction = OnBufferAction;
        }
Example #2
0
 /// <summary>
 /// Constructor that supplies an explict Action />
 /// </summary>
 /// <param name="bufferAction"></param>
 public AsyncBuffer(AsyncBufferAction <T> bufferAction) : this()
 {
     _bufferAction = bufferAction;
 }