コード例 #1
0
        public void InitSettings(ILogWriterConfiguration configuration)
        {
            FileLogWriterConfigurationSection fileWriterConfiguration = ( FileLogWriterConfigurationSection )configuration;

            _textWriter  = new StreamWriter(fileWriterConfiguration.FileName);
            _minLogLevel = fileWriterConfiguration.MinimumLogLevel;
        }
コード例 #2
0
        public void InitSettings(ILogWriterConfiguration configuration)
        {
            var eMailWriterConfiguration = ( PoolingEMailLogWriterConfigurationSection )configuration;

            _minLogLevel             = eMailWriterConfiguration.MinimumLogLevel;
            _initialPoolingSeconds   = eMailWriterConfiguration.InitialPoolingSeconds;
            _incrementPoolingSeconds = eMailWriterConfiguration.IncrementPoolingSeconds;
        }
コード例 #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);
         }
     }
 }
コード例 #4
0
        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();
        }
コード例 #5
0
 public void InitSettings(ILogWriterConfiguration configuration)
 {
 }
コード例 #6
0
 public void Initialize(ILogWriterConfiguration configuration)
 {
     UseBackgroundThreadQueue = configuration.UseBackgroundTheadQueue;
 }
コード例 #7
0
 public abstract void InitSettings(ILogWriterConfiguration configuration);
コード例 #8
0
 public void Initialize(ILogWriterConfiguration configuration)
 {
     // Always default to a direct Writer
     UseBackgroundThreadQueue = false;
 }
コード例 #9
0
        public void InitSettings(ILogWriterConfiguration configuration)
        {
            var eMailWriterConfiguration = ( EMailLogWriterConfigurationSection )configuration;

            this._minLogLevel = eMailWriterConfiguration.MinimumLogLevel;
        }