Exemple #1
0
        private void WriteLog(BootstrapLog log)
        {
            Console.BackgroundColor = _defaultBackgroundColor;

            switch (log.LogLevel)
            {
            case LogLevel.Error:
                Console.ForegroundColor = ConsoleColor.Red;
                break;

            case LogLevel.Information:
                Console.ForegroundColor = ConsoleColor.Black;
                break;

            case LogLevel.Warning:
                Console.BackgroundColor = ConsoleColor.Yellow;
                break;

            default:
                Console.ForegroundColor = _defaultBackgroundColor;
                break;
            }

            Console.WriteLine($"{log.LogLevel} ==> {log.Message}");
            Console.ForegroundColor = _defaultForegroundColor;
        }
Exemple #2
0
        public void Add(LogLevel logLevel, string message, params object[] args)
        {
            var log = new BootstrapLog(logLevel, message)
            {
                Args = args
            };

            _logs.Add(log);
        }