コード例 #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");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Speak91/Nordic-it-netcore
        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");
        }
コード例 #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((string)parameters);
            MultipleLogWriter MultipleLog = new MultipleLogWriter(new List <ILogWriter> {
                ConsoleLog, FileLog
            });

            return(MultipleLog);
        }
コード例 #4
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);
        }