Пример #1
0
        static void Main(string[] args)
        {
            FileLogWriter.ChangeOfFileName("FileLog.txt");
            var conslog  = ConsoleLogWriter.Instance;
            var textlog  = FileLogWriter.Instance;
            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");
        }
Пример #2
0
        static void Main()
        {
            var cons = ConsoleLogWriter.Instance;

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

            FileLogWriter.Filename = filename;
            var file = FileLogWriter.Instance;

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

            mult.LogInfo("конлсь инфо");
            mult.LogWarning("конлсь варнинг");
            mult.LogError("конлсь ерор");
            Console.ReadKey();
        }