Example #1
0
        public void Write(string value)
        {
            var now = _timeSource.Time;

            if (_appender == null || (now - _curDate).Days != 0)
            {
                _curDate = now.Date;
                _appender?.Dispose();
                _appender = _factory.Create();
            }

            _appender.Write(value);
        }
Example #2
0
        private void MainLoopSafe()
        {
            while (!_exit)
            {
                if (_lines.Count == 0)
                {
                    _flushEvent.Set();
                }

                LogLine logLine   = _lines.Take();
                var     formatted = logLine.Format();
                _appender.Write(formatted);
            }

            _flushEvent.Set();
        }