コード例 #1
0
        static void Main(string[] args)
        {
            var conslog  = new ConsoleLogWriter();
            var textlog  = new FileLogWriter();
            var conslog1 = new ConsoleLogWriter();
            var textlog1 = new FileLogWriter();

            conslog.LogInfo("Some information about the program");
            textlog.LogError("Some information about the error in the program");
            conslog1.LogInfo("Warning about possible problems in the program");
            textlog1.LogError("Some information about the error in the program");
            var multi = new MultipleLogWriter(new AbstractLogWriter[] { conslog, textlog, conslog1, textlog1 });
        }
コード例 #2
0
        static void Main()
        {
            var cons = new ConsoleLogWriter();

            cons.LogWarning("ВОт ЭТО ОШИБКа");
            cons.LogError("Err");
            cons.LogInfo("ИНфо");
            var file = new FileLogWriter();

            file.LogWarning("ВОт ЭТО ОШИБКа");
            file.LogError("Err");
            file.LogInfo("ИНфо");
            var mult = new MultipleLogWriter(cons, file);

            mult.LogInfo("конлсь инфо");
            mult.LogWarning("конлсь варнинг");
            mult.LogError("конлсь ерор");
            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var fileLogWriter = new FileLogWriter();

            fileLogWriter.LogError("FileLogWriter says there is an error!");

            var consoleLogWriter = new ConsoleLogWriter();

            consoleLogWriter.LogWarning("ConsoleLogWriter says there is a warning!");

            var multipleLogWriter = new MultipleLogWriter(new List <AbstractLogWriter>
            {
                new FileLogWriter(),
                new ConsoleLogWriter(),
                new MultipleLogWriter(new List <AbstractLogWriter>
                {
                    new ConsoleLogWriter(),
                    new ConsoleLogWriter()
                })
            });

            multipleLogWriter.LogInfo("MultipleLogWriter created");
        }
コード例 #4
0
 public void LogError(string message)
 {
     fileLogWriterObject.LogError(message);
     consoleLogWriterObject.LogError(message);
 }