public static MultipleLogWriter GetInstance(List <ILogWriter> logWriters) { List <ILogWriter> logWriters2 = logWriters; if (instance == null) { instance = new MultipleLogWriter(logWriters2); } return(instance); }
static void Main(string[] args) { List <ILogWriter> logs = new List <ILogWriter>(); logs.Add(FileLogWriter.GetInstance()); logs.Add(ConsoleLogWriter.GetInstance()); MultipleLogWriter logWriter = MultipleLogWriter.GetInstance(logs); logWriter.LogError("Error"); logWriter.LogInfo("Info"); logWriter.LogInfo("Warning"); }
static void Main(string[] args) { FileLogWriter fileLogWriter = new FileLogWriter(); ConsoleLogWriter consoleLog = new ConsoleLogWriter(); List <ILogWriter> logs = new List <ILogWriter>(); logs.Add(fileLogWriter); logs.Add(consoleLog); MultipleLogWriter logWriter = new MultipleLogWriter(logs); logWriter.LogError("Error"); logWriter.LogInfo("Info"); logWriter.LogInfo("Warning"); }
public static ILogWriter GetLogWriter <T>(object parameters) where T : ILogWriter { if (instance == null) { instance = new LogWriterFactory(); } ConsoleLogWriter ConsoleLog = new ConsoleLogWriter(); FileLogWriter FileLog = new FileLogWriter((string)parameters); MultipleLogWriter MultipleLog = new MultipleLogWriter(new List <ILogWriter> { ConsoleLog, FileLog }); return(MultipleLog); }
public static ILogWriter GetLogWriter <T>(object parameters) where T : ILogWriter { if (instance == null) { instance = new LogWriterFactory(); } ConsoleLogWriter ConsoleLog = new ConsoleLogWriter(); FileLogWriter FileLog = new FileLogWriter(); MultipleLogWriter MultipleLog = new MultipleLogWriter(new List <ILogWriter> { ConsoleLog, FileLog }); MultipleLog.LogError("Error"); MultipleLog.LogInfo("Info"); MultipleLog.LogInfo("Warning"); return(MultipleLog); }