public void Add_Logger_provider_into_a_new_configuration_manager()
        {
            ILoggerConfigManager configmanager = GetaTestConfigManager(_configPath);
            ILoggerSettings      settings      = configmanager.Load();

            settings.setEnvironment(_environmentName);
            settings.addProvider(GetaTestProvider(_testprovidername));
            Assert.That(settings.getProvider(_testprovidername), !Is.Null);
        }
        public void Make_default_settings_and_save_to_disk()
        {
            ILoggerConfigManager configmanager = GetaTestConfigManager(_configPath);
            ILoggerSettings      settings      = configmanager.Load();

            settings.setEnvironment(_environmentName);
            settings.addProvider(GetaTestProvider(_testprovidername));
            configmanager.Write();
            Assert.That(File.Exists(_configPath), Is.True);
        }
        public void Create_Save_And_Load_logger_configuration_from_disk()
        {
            ILoggerConfigManager configmanager = GetaTestConfigManager(_configPath);
            ILoggerSettings      settings      = configmanager.Load();

            settings.setEnvironment(_environmentName);
            settings.addProvider(GetaTestProvider(_testprovidername));
            configmanager.Write();
            Assert.That(File.Exists(_configPath), Is.True);
            Assert.That(configmanager.Reset(), Is.Null);
            settings = configmanager.Load();
            Assert.That(settings, !Is.Null);
            Assert.That(settings.getProvider(_testprovidername), !Is.Null);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            ILoggerConfigManager configManager = new QuickLoggerFileConfigManager(_configName);
            ILoggerSettings      settings      = configManager.Load();

            foreach (ILoggerProvider provider in _providers)
            {
                if (provider.getProviderProperties().GetProviderType() == "ConsoleProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_consoleproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "FileProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_fileproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "RedisProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_redisproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "SlackProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_slackproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "RestProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_restproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "EmailProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_emailproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "AdoProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_adoproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "WindowsEventProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_windowseventlogproviderinfo);
                }
                else if (provider.getProviderProperties().GetProviderType() == "SyslogProvider")
                {
                    provider.getProviderProperties().SetProviderInfo(_syslogproviderinfo);
                }
                settings.addProvider(provider);
            }
            configManager.Write();
        }