示例#1
0
        static void Main(string[] args)
        {
            var fileLogWriter = FileLogWriter.GetInstance();

            fileLogWriter._fileName = "log.log";
            fileLogWriter.LogWarning("Warning!");

            var consoleLogWriter = ConsoleLogWriter.Instance;

            consoleLogWriter.LogInfo("Information.");

            var multipleLogWriter = new MultipleLogWriter(
                ConsoleLogWriter.Instance,
                ConsoleLogWriter.Instance,
                FileLogWriter.GetInstance()
                );

            multipleLogWriter.LogError("Some Error!");

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            var fileLogWriter = new FileLogWriter("log1.log");

            fileLogWriter.LogWarning("Warning!");

            var consoleLogWriter = new ConsoleLogWriter();

            consoleLogWriter.LogInfo("Information.");

            var multipleLogWriter = new MultipleLogWriter(
                new ConsoleLogWriter(),
                new ConsoleLogWriter(),
                new ConsoleLogWriter(),
                new ConsoleLogWriter(),
                new FileLogWriter("log1.log"),
                new FileLogWriter("log2.log")
                );

            multipleLogWriter.LogError("Some Error!");

            Console.ReadKey();
        }
示例#3
0
 public static FileLogWriter GetInstance()
 {
     return(instance ?? (instance = new FileLogWriter()));
 }