Example #1
0
        static void Main()
        {
            // Introduce custom formatter
            IFormatter formatter = new CrazyFormatter();

            FileAppender appender = new FileAppender("file.txt", formatter);
            Logger       logger   = new Logger(appender);

            try
            {
                logger.Critical("a cannot be 5");
                logger.Critical("Out of memory");
                // CauseException();
                logger.Info("Unused local variable 'name'");
            }
            finally
            {
                appender.Close();
            }
        }
Example #2
0
        static void Main()
        {
            // Introduce custom formatter
            IFormatter formatter = new CrazyFormatter();

            FileAppender appender = new FileAppender("file.txt", formatter);
            Logger logger = new Logger(appender);

            try
            {
                logger.Critical("a cannot be 5");
                logger.Critical("Out of memory");
                // CauseException();
                logger.Info("Unused local variable 'name'");
            }
            finally
            {
                appender.Close();
            }
        }