public override void OnTrace(TraceEntry entry) { if(entry == null) return; System.Diagnostics.EventLog.WriteEntry(entry.Source, entry.ToString(), GetEventLogEntryType(entry.EntryType)); }
public override void OnTrace(TraceEntry entry) { if(entry == null) return; ConsoleColor foregroundColor = Console.ForegroundColor; switch(entry.EntryType) { case TraceEntryType.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case TraceEntryType.Failure: Console.ForegroundColor = ConsoleColor.Magenta; break; case TraceEntryType.Error: Console.ForegroundColor = ConsoleColor.Red; break; } try { Console.WriteLine(entry.ToString(false)); } finally { Console.ForegroundColor = foregroundColor; } }