public void InitSettings(ILogWriterConfiguration configuration)
        {
            FileLogWriterConfigurationSection fileWriterConfiguration = ( FileLogWriterConfigurationSection )configuration;

            _textWriter  = new StreamWriter(fileWriterConfiguration.FileName);
            _minLogLevel = fileWriterConfiguration.MinimumLogLevel;
        }
Esempio n. 2
0
        public void InitSettings(ILogWriterConfiguration configuration)
        {
            var eMailWriterConfiguration = ( PoolingEMailLogWriterConfigurationSection )configuration;

            _minLogLevel             = eMailWriterConfiguration.MinimumLogLevel;
            _initialPoolingSeconds   = eMailWriterConfiguration.InitialPoolingSeconds;
            _incrementPoolingSeconds = eMailWriterConfiguration.IncrementPoolingSeconds;
        }
Esempio n. 3
0
 private void LoadConfiguration(System.Configuration.Configuration configuration)
 {
     foreach (ConfigurationSection section in configuration.Sections)
     {
         if (typeof(ILogWriterConfiguration).IsAssignableFrom(section.GetType()))
         {
             ILogWriterConfiguration logWriterConfiguration = ( ILogWriterConfiguration )section;
             ILogWriter logWriter = ( ILogWriter )this.DependencyResolver.Resolve(logWriterConfiguration.LogWriterType);
             logWriter.InitSettings(logWriterConfiguration);
             RegisterLogWriter(logWriter);
         }
     }
 }
        public void Initialize(ILogWriterConfiguration configuration)
        {
            var processName = Process.GetCurrentProcess().ProcessName;

            if (configuration == null)
            {
                UseBackgroundThreadQueue = true;
                _fileName = processName + ".log";
                _archive.ArchiveZipSearchPattern = "*.Log";
                _maxFileSizeInBytes = CLogSizeMax;
            }
            else
            {
                UseBackgroundThreadQueue = configuration.UseBackgroundTheadQueue;
                _fileName = configuration.Attributes.GetValue(CLogFileName, $"{processName}.log");
                _archive.ArchiveZipSearchPattern = configuration.Attributes.GetValue(CZipSearchPattern, "*.Log");
                _maxFileSizeInBytes          = configuration.Attributes.GetValue(CMaxFileSizeInBytes, CLogSizeMax);
                _purge.MaxStorageSizeInBytes = configuration.Attributes.GetValue(CMaxStorageSizeInBytes, PurgeSelfMaintain.NoStorageSizeMax);
                _purge.MaxDaysToKeepLogs     = configuration.Attributes.GetValue(CMaxDaysToKeepLogs, PurgeSelfMaintain.KeepLogsForever);
            }

            if (string.IsNullOrEmpty(_currentDirectory))
            {
                // ReSharper disable once AssignNullToNotNullAttribute
                _currentDirectory =
                    Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Log");
                _purge.CurrentDirectory   = _currentDirectory;
                _purge.FileName           = _fileName;
                _archive.CurrentDirectory = _currentDirectory;
                _archive.FileName         = _fileName;
            }

            _lastLogEntryWrittenDate = DateTime.Now;

            SetupWriter();
            _isInitialized = true;

            LogVersionInformation();
        }
 public void InitSettings(ILogWriterConfiguration configuration)
 {
 }
Esempio n. 6
0
 public void Initialize(ILogWriterConfiguration configuration)
 {
     UseBackgroundThreadQueue = configuration.UseBackgroundTheadQueue;
 }
Esempio n. 7
0
 public abstract void InitSettings(ILogWriterConfiguration configuration);
Esempio n. 8
0
 public void Initialize(ILogWriterConfiguration configuration)
 {
     // Always default to a direct Writer
     UseBackgroundThreadQueue = false;
 }
        public void InitSettings(ILogWriterConfiguration configuration)
        {
            var eMailWriterConfiguration = ( EMailLogWriterConfigurationSection )configuration;

            this._minLogLevel = eMailWriterConfiguration.MinimumLogLevel;
        }