Example #1
0
        private static void TestDecoratorWithLogger()
        {
            ILogger logger = new FileLogAdapter(new FileLogger());

            var calculator       = new ConcreteCalculator();
            var loggerCalculator = new DecoratorLogCalculator(calculator, logger);

            calculator.Add(3, 4);
            loggerCalculator.Add(1, 2);
        }
Example #2
0
        private static void TestLoggers()
        {
            ILogger logger = new FileLogAdapter(new FileLogger());

            logger.LogInfo("Message 1");
            logger.LogError("Message 2");

            logger = new DbLogAdapter(new DbLogger());

            logger.LogInfo("Message 3");
            logger.LogError("Message 4");
        }