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); }
static void Main(string[] args) { var test = LogWriterFactory.GetLogWriter <ILogWriter>(@"C:\Users\ar199\Desktop\log.txt"); test.LogError("error!"); }