示例#1
0
        static void Main(string[] args)
        {
            //FileLogWriter fileLogWriter1 = new FileLogWriter(@"C:\Users\zalimbekova\test1_log.txt");
            //LogWriterFactory fileLogWriter1 = LogWriterFactory.GetInstance();
            using var fileLogWriter1 = (FileLogWriter)LogWriterFactory.GetLogWriter <FileLogWriter>(@"C:\Users\zalimbekova\test1_log.txt");

            var consoleWriter1 = (ConsoleLogWriter)LogWriterFactory.GetLogWriter <ConsoleLogWriter>(null);
            var multi          = (MultipleLogWriter)LogWriterFactory.GetLogWriter <MultipleLogWriter>(new[] { (ILogWriter)fileLogWriter1, (ILogWriter)consoleWriter1 });

            ///ConsoleLogWriter consoleWriter1 = new ConsoleLogWriter();

            //using var logwriter = new MultipleLogWriter(new[] { (ILogWriter)fileLogWriter1, (ILogWriter)consoleWriter1 });
            multi.LogInfo("starting the system");
            multi.LogWarning("the disc is almost full");
            multi.LogError("the system has crashed");

            //LogWriterFactory factory = new LogWriterFactory();
            //var log1 = factory.GetLogWriter<MultipleLogWriter<ILogWriter>>(ILogWriter);
        }
示例#2
0
        static void Main(string[] args)
        {
            var test = LogWriterFactory.GetLogWriter <ILogWriter>(@"C:\Users\jimac\Desktop\log.txt");

            test.LogError("error!");


            //var clw = new ConsoleLogWriter();
            ////clw.LogInfo("Test Information message");

            //var flw = new FileLogWriter(@"C:\Users\jimac\Desktop\log.txt");
            ////flw.LogInfo("Test information message");

            //var mlw = new MultipleLogWriter(new List<ILogWriter> { clw, flw });
            //clw.LogInfo("Test info mess");
            //flw.LogInfo("Test info mess");
            //mlw.LogInfo("testsdasd");
            //mlw.Dispose();
            //flw.Dispose();
        }