public static MultipleLogWriter GetInstance()
        {
            if (_multiLogInstance == null)
            {
                _multiLogInstance = new MultipleLogWriter();
            }

            return(_multiLogInstance);
        }
Ejemplo n.º 2
0
        static void Main()
        {
            var consoleLog = ConsoleLogWriter.GetInstance();

            using var fileLog = FileLogWriter.GetInstance();
            fileLog.FileName  = "Logs";

            List <ILogWriter> listOfLogWriters = new List <ILogWriter>
            {
                consoleLog,
                fileLog
            };

            var multiple = MultipleLogWriter.GetInstance();

            multiple.LogWriters = listOfLogWriters;

            multiple.LogInfo("There is some information from Multiple Log Writer!");
            multiple.LogWarning("Warning!!!");
            multiple.LogError("Error!!!");
        }