Пример #1
0
        static void Main(string[] args)
        {
            var conslog  = new ConsoleLogWriter();
            var textlog  = new FileLogWriter("log.txt");
            var multi    = new ILogWriter[] { conslog, textlog };   //save instances in a variable
            var multilog = new MultipleLogWriter(multi);            //create a new instance and pass as an argument a variable that stores a collection of instances

            multilog.LogInfo("Some information about the program"); //new event to record
            multilog.LogError("Some information about the error in the program");
            multilog.LogInfo("Warning about possible problems in the program");
            multilog.LogError("Some information about the error in the program");
        }
Пример #2
0
        static void Main(string[] args)
        {
            var logInFile    = new FileLogWriter();
            var logInConsole = new ConsoleLogWriter();

            var multipleLogWriter = new MultipleLogWriter(logInFile, logInConsole);

            multipleLogWriter.LogError("ErrorMessage");
            multipleLogWriter.LogInfo("InfoMessage");
            multipleLogWriter.LogWarning("WarningMessage");

            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            var logInFile    = FileLogWriter.GetInstance("C:/StudioLog/Log.log");
            var logInConsole = ConsoleLogWriter.GetInstance();

            var multipleLogWriter = new MultipleLogWriter(logInFile, logInConsole);

            multipleLogWriter.LogError("ErrorMessage");
            multipleLogWriter.LogInfo("InfoMessage");
            multipleLogWriter.LogWarning("WarningMessage");

            Console.ReadKey();
        }
Пример #4
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 });
        }
Пример #5
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();
        }
Пример #6
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");
        }