Пример #1
0
        static void Main(string[] args)
        {
            var     providerType = GetTypeOfLoggingProviderFromConfigFile();
            ILogger logger       = LoggerProviderFactory.GetLoggerProvider(providerType);

            logger.LogMessage("Hello from Factory Method!");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            var logger = LoggerProviderFactory.GetLoggerProvider(LoggerType.Log4Net);

            logger.LogMessage("Test 1");
            logger.LogMessage("Test 2");
            logger = LoggerProviderFactory.GetLoggerProvider(LoggerType.MyLogger);
            logger.LogMessage("Test 3");
            logger.LogMessage("Test 4");
            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            LoggerProviderFactory loggerProviderFactory = new LoggerProviderFactory();
            var logger1 = loggerProviderFactory.GetLoggingProvider("Log4Net");
            var logger2 = loggerProviderFactory.GetLoggingProvider("EnterpriseLogger");

            logger1.LogMessage();
            logger1.LogError();

            logger2.LogMessage();
            logger2.LogError();

            Console.ReadKey();
        }