Пример #1
0
 public void WriteLogEntry(LogEntry entry)
 {
     lock (this)
     {
         // Prevent race condition during disposal
         if (!disposed)
         {
             writer.WriteLine("{0} {1} {2}",
                 DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ffffff"),
                 logLevelNameMap[entry.Level],
                 entry.Text);
         }
     }
 }
Пример #2
0
        void ILogger.WriteLogEntry(LogEntry entry)
        {
            HandlePause();

            switch (entry.Level)
            {
                case LogLevel.Error:
                    WriteMessage(Brushes.OrangeRed, entry.Text);
                    break;

                case LogLevel.Warning:
                    WriteMessage(Brushes.Orange, entry.Text);
                    break;

                case LogLevel.Info:
                    WriteMessage(Brushes.White, entry.Text);
                    break;

                case LogLevel.Fine:
                    WriteMessage(Brushes.DarkGray, entry.Text);
                    break;
            }
        }