Пример #1
0
        public void Append(LogEntry entry)
        {
            if ((entry.Type & Mask) != 0)
            {
                var oldColor = Console.ForegroundColor;

                switch (entry.Type)
                {
                    case LogEntryType.Debug:
                        Console.ForegroundColor = ConsoleColor.Green;
                        break;

                    case LogEntryType.Info:
                        Console.ForegroundColor = ConsoleColor.Gray;
                        break;

                    case LogEntryType.Warning:
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        break;

                    case LogEntryType.Error:
                        Console.ForegroundColor = ConsoleColor.Red;
                        break;
                }

                Console.WriteLine(entry.Message);

                if (entry.Exception != null)
                {
                    Console.WriteLine(entry.Exception);
                }

                Console.ForegroundColor = oldColor;
            }
        }
Пример #2
0
 public static void Log(LogEntry entry)
 {
     foreach (var appender in m_logAppenders)
     {
         appender.Append(entry);
     }
 }