Example #1
0
        /// <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");

            RaspberryDebugPackage.Log(sb.ToString());
        }
Example #2
0
 /// <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 = "")
 {
     RaspberryDebugPackage.Log(text + "\n");
 }
Example #3
0
 /// <summary>
 /// Writes text to the debug pane.
 /// </summary>
 /// <param name="text">The text text.</param>
 public static void Write(string text)
 {
     RaspberryDebugPackage.Log(text);
 }