public void HandleException(VulcanMessage e) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; //Console.Error.WriteLine("{0}:{1}", Name, e.Message); Console.ForegroundColor = color; }
public void Trace(VulcanMessage e) { ClearStatus(); _errorDictionary[e.Severity].Add(e); if (e.Severity == Severity.Debug) { if (VulcanEngine.Properties.Settings.Default.ShowDebug) { Console.WriteLine("{0}:{1}", Name, e.Message); } } else if (e.Severity == Severity.Alert) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("{0}:{1}", Name, e.Message); Console.ForegroundColor = color; } else if (e.Severity == Severity.Warning) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; Console.Error.WriteLine("{0}:{1}", Name, e.Message); Console.ForegroundColor = color; } else if (e.Severity == Severity.Error) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine("{0}:{1}", Name, e.Message); Console.ForegroundColor = color; } else { if (VulcanEngine.Properties.Settings.Default.ShowNotifications || e.Severity == Severity.Alert) { Console.WriteLine("{0}:{1}", Name, e.Message); } } if ((e.Severity == Severity.Error) && (_breakOnError)) { HandleException(e); ThrowException(e); } DisplayStatus(); }
public static void Trace(VulcanMessage vulcanMessage) { _errorDictionary[vulcanMessage.Severity].Add(vulcanMessage); if (!MSBuildTrace(vulcanMessage)) { ClearStatus(); int lineWidth = _consoleIsValid ? Console.BufferWidth : Int32.MaxValue; if (vulcanMessage.Severity == Severity.Debug) { if (Settings.Default.ShowDebug) { WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth); } } else if (vulcanMessage.Severity == Severity.Alert) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth); Console.ForegroundColor = color; } else if (vulcanMessage.Severity == Severity.Warning) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Error, lineWidth); Console.ForegroundColor = color; } else if (vulcanMessage.Severity == Severity.Error) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Error, lineWidth); Console.ForegroundColor = color; } else { if (Settings.Default.ShowNotifications || vulcanMessage.Severity == Severity.Alert) { WriteWithWordLineBreaks(vulcanMessage.AnnotatedMessage, Console.Out, lineWidth); } } DisplayStatus(); } }
private static bool MSBuildTrace(VulcanMessage message) { if (MSBuildTask != null) { switch (message.Severity) { case Severity.Error: MSBuildTask.BuildEngine.LogErrorEvent ( new BuildErrorEventArgs ( String.Empty, message.Code, message.FileName, message.Line, message.Offset, 0, 0, message.AnnotatedMessage, String.Empty, String.Empty ) ); break; case Severity.Warning: MSBuildTask.BuildEngine.LogWarningEvent( new BuildWarningEventArgs ( String.Empty, message.Code, message.FileName, message.Line, message.Offset, 0, 0, message.AnnotatedMessage, String.Empty, String.Empty ) ); break; case Severity.Notification: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low)); break; case Severity.Alert: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.High)); break; #if DEBUG case Severity.Debug: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low)); break; #endif default: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Normal)); break; } // end switch(message.Severity) return true; } // end #if msbuild!=null return false; }
private static bool MSBuildTrace(VulcanMessage message) { if (MSBuildTask != null) { switch (message.Severity) { case Severity.Error: MSBuildTask.BuildEngine.LogErrorEvent ( new BuildErrorEventArgs ( String.Empty, message.Code, message.FileName, message.Line, message.Offset, 0, 0, message.AnnotatedMessage, String.Empty, String.Empty ) ); break; case Severity.Warning: MSBuildTask.BuildEngine.LogWarningEvent( new BuildWarningEventArgs ( String.Empty, message.Code, message.FileName, message.Line, message.Offset, 0, 0, message.AnnotatedMessage, String.Empty, String.Empty ) ); break; case Severity.Notification: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low)); break; case Severity.Alert: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.High)); break; #if DEBUG case Severity.Debug: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Low)); break; #endif default: MSBuildTask.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(message.AnnotatedMessage, String.Empty, string.Empty, MessageImportance.Normal)); break; } // end switch(message.Severity) return(true); } // end #if msbuild!=null return(false); }
public void ThrowException(VulcanMessage e) { throw new Exception(e.Message); }
public void Trace(Severity severity, Exception exception, string message, params object[] formatParameters) { VulcanMessage ve = new VulcanMessage(severity, exception, message, formatParameters); this.Trace(ve); }