예제 #1
0
        public static MultipleLogWriter GetInstance(List <ILogWriter> logWriters)
        {
            List <ILogWriter> logWriters2 = logWriters;

            if (instance == null)
            {
                instance = new MultipleLogWriter(logWriters2);
            }
            return(instance);
        }
예제 #2
0
        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");
        }
예제 #3
0
        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);
        }
예제 #5
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();
            MultipleLogWriter MultipleLog = new MultipleLogWriter(new List <ILogWriter> {
                ConsoleLog, FileLog
            });

            MultipleLog.LogError("Error");
            MultipleLog.LogInfo("Info");
            MultipleLog.LogInfo("Warning");
            return(MultipleLog);
        }