Exemplo n.º 1
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");
        }
Exemplo n.º 2
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");
        }
Exemplo n.º 3
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);
        }