public static ConsoleLogWriter GetInstance()
        {
            if (_consoleLogInstance == null)
            {
                _consoleLogInstance = new ConsoleLogWriter();
            }

            return(_consoleLogInstance);
        }
Exemplo 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!!!");
        }