/// <summary> /// Writes an exception to the Visual Studio debug pane. /// </summary> /// <param name="e">The exception.</param> /// <param name="message">Optional text to include before the exception information.</param> public static void Exception(Exception e, string message = null) { if (e == null) { return; } // We're going to build a multi-line message to reduce pressure // on the task/threading in [RaspberryDebugPackage.Log()]. var sb = new StringBuilder(); sb.Append("\n"); if (string.IsNullOrEmpty(message)) { sb.Append($"EXCEPTION: {e.GetType().FullName}: {e.Message}\n"); } else { sb.Append($"EXCEPTION: {e.GetType().FullName}: {message} {e.Message}\n"); } sb.Append(e.StackTrace); sb.Append("\n"); RaspberryDebuggerPackage.Log(sb.ToString()); }
/// <summary> /// Writes a line of text to the Visual Studio debug pane. /// </summary> /// <param name="text">Optionally specifies the log text.</param> public static void WriteLine(string text = "") { RaspberryDebuggerPackage.Log(text + "\n"); }
/// <summary> /// Writes text to the debug pane. /// </summary> /// <param name="text">The text text.</param> public static void Write(string text) { RaspberryDebuggerPackage.Log(text); }