Esempio n. 1
0
        static void Main(string[] args)
        {
            ILogger logger = new QuickLoggerNative(".\\");

            try
            {
                System.Console.WriteLine(LoggerEventTypes.LOG_ALL.ToString());

                DeleteDemoFiles();

                ILoggerProvider myFileDemoProvider    = CreateFileDemoProvider(FILELOGPATH);
                ILoggerProvider myConsoleDemoProvider = CreateConsoleDemoProvider();
                AssignProviderCallbacks(myFileDemoProvider);
                AssignProviderCallbacks(myConsoleDemoProvider);

                //Create new config instance, ADD Providers and Write to disk.
                ILoggerConfigManager configManager = new QuickLoggerFileConfigManager(CONFIGPATH);
                if (File.Exists(CONFIGPATH))
                {
                    configManager.Load();
                }
                else
                {
                    //Add providers to settings
                    configManager.GetSettings().addProvider(myFileDemoProvider);
                    configManager.GetSettings().addProvider(myConsoleDemoProvider);
                    //Write settings to disk
                    configManager.Write();
                }

                //Create a new instance of NativeQuickLogger
                configManager.GetSettings().Providers().ForEach(x => logger.AddProvider(x));

                System.Console.WriteLine(logger.GetLoggerNameAndVersion());

                // Main!
                logger.Info("QuickLogger demo program main loop started.");

                for (int x = 0; x < 100; x++)
                {
                    logger.Info("Info");
                    for (int y = 0; y < 100; y++)
                    {
                        logger.Error("Error");
                        for (int z = 0; z < 100; z++)
                        {
                            logger.Custom("Custom");
                        }
                    }
                }

                logger.Info("QuickLogger demo program finished.");
                System.Console.ReadKey();
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.Message + " " + logger.GetLastError());
                System.Console.ReadKey();
            }
        }
Esempio n. 2
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();
        }
        public void Create_new_configuration_manager()
        {
            ILoggerConfigManager configManager = new QuickLoggerFileConfigManager(_configPath);

            Assert.That(configManager, !Is.Null);
        }
        public ILoggerConfigManager GetaTestConfigManager(string configpath)
        {
            ILoggerConfigManager configmanager = new QuickLoggerFileConfigManager(configpath);

            return(configmanager);
        }