static void Main(string[] args) { var consoleLogWriter = new ConsoleLogWriter(); var fileLogWriter = new FileLogWriter(); var multipleLogWriter = new MultipleLogWriter(consoleLogWriter, fileLogWriter); multipleLogWriter.LogError("Some error"); multipleLogWriter.LogWarning("Some warning"); multipleLogWriter.LogInfo("Some info"); }
static void Main(string[] args) { var consoleLogWriter = new ConsoleLogWriter(); var fileLogWriter = new FileLogWriter(); var multipleLogWriter = new MultipleLogWriter(new ILogerWriter[] { consoleLogWriter, fileLogWriter }); consoleLogWriter.LogInfo("LogInfo"); consoleLogWriter.LogWarning("LogWarning"); consoleLogWriter.LogError("LogError"); fileLogWriter.LogInfo("LogInfo"); fileLogWriter.LogWarning("LogWarning"); fileLogWriter.LogError("LogError"); }
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(); }
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(); }