Example #1
0
        /// <summary>
        /// Called when [configuration file change].
        /// </summary>
        static internal void OnConfigFileChange()
        {
            _eventTracking = new TimeSpan(0, ReflectInsightConfig.Settings.GetExceptionEventTracker(20), 0);

            var mode     = ReflectInsightConfig.Settings.GetExceptionManagerAttribute("mode", "off");
            var filePath = ReflectInsightConfig.Settings.GetExceptionManagerAttribute("filePath", @"$(workingdir)\RI.Exceptions.txt");
            var recycle  = ReflectInsightConfig.Settings.GetExceptionManagerAttribute("recycle", "7");

            var oldWriter = _logTextFileWriter;

            if (mode == "on")
            {
                if (int.TryParse(recycle, out int irecycle) == false)
                {
                    irecycle = 7;
                }

                _logTextFileWriter = _logTextFileWriterFactory.Create(filePath, irecycle, true);
            }
            else
            {
                _logTextFileWriter = new LogNullFileWriter();
            }

            oldWriter?.Dispose();
        }
Example #2
0
        /// <summary>
        /// Creates the text file writer.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="recycle">The recycle.</param>
        protected void CreateTextFileWriter(string filePath, int recycle)
        {
            if (string.IsNullOrWhiteSpace(filePath))
            {
                return;
            }

            if (_logTextFileWriter == null)
            {
                _logTextFileWriter = new LogTextFileWriter(filePath, recycle, true);
            }
        }
Example #3
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            lock (this)
            {
                if (!Disposed)
                {
                    Disposed = true;
                    GC.SuppressFinalize(this);

                    _logTextFileWriter?.Dispose();
                    _logTextFileWriter = null;
                }
            }
        }
Example #4
0
 /// <summary>
 /// Called when [shutdown].
 /// </summary>
 static internal void OnShutdown()
 {
     _logTextFileWriter?.Dispose();
     _logTextFileWriter = null;
 }