コード例 #1
0
        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);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var test = LogWriterFactory.GetLogWriter <ILogWriter>(@"C:\Users\ar199\Desktop\log.txt");

            test.LogError("error!");
        }