Example #1
0
        private static void FormatStackTrace(LogExceptionEntry entry, StringBuilder text)
        {
            if (entry.Exception == null)
            {
                return;
            }

            text.AppendLine();
            text.AppendLine("Stack Trace");
            text.AppendLine();
            text.AppendLine(entry.Exception.StackTrace);
            text.AppendLine(TextResources.DashedBreak80Wide);
        }
Example #2
0
        private static string FormatException(LogExceptionEntry entry)
        {
            var text = new StringBuilder();

            if (string.IsNullOrWhiteSpace(entry.Message) == false)
            {
                text.AppendLine(entry.Message.Trim());
            }

            if (entry.Exception == null)
            {
                text.AppendLine(TextResources.Errors.NoExceptionProvided);
                return(text.ToString());
            }

            text.AppendLine(TextResources.Errors.ErrorInfo);
            text.AppendLine(TextResources.DashedBreak80Wide);

            var inner = entry.Exception;

            while (inner != null)
            {
                try
                {
                    if (FormatSqlException(text, inner as SqlException) ||
                        FormatSmtpException(text, inner as SmtpException))
                    {
                    }
                    else
                    {
                        text.AppendFormat("{0} : {1}", inner.GetType().FullName, inner.Message);
                    }
                }
                finally
                {
                    text.AppendLine();
                    inner = inner.InnerException;
                }
            }

            FormatStackTrace(entry, text);

            return(text.ToString());
        }
        private static string FormatException(LogExceptionEntry entry)
        {
            var text = new StringBuilder();

            if (string.IsNullOrWhiteSpace(entry.Message) == false)
                text.AppendLine(entry.Message.Trim());

            if (entry.Exception == null)
            {
                text.AppendLine(TextResources.Errors.NoExceptionProvided);
                return text.ToString();
            }

            text.AppendLine(TextResources.Errors.ErrorInfo);
            text.AppendLine(TextResources.DashedBreak80Wide);

            var inner = entry.Exception;
            while (inner != null)
            {
                try
                {
                    if (FormatSqlException(text, inner as SqlException) ||
                        FormatSmtpException(text, inner as SmtpException))
                    {
                    }
                    else
                        text.AppendFormat("{0} : {1}", inner.GetType().FullName, inner.Message);
                }
                finally
                {
                    text.AppendLine();
                    inner = inner.InnerException;
                }
            }

            FormatStackTrace(entry, text);

            return text.ToString();
        }
        private static void FormatStackTrace(LogExceptionEntry entry, StringBuilder text)
        {
            if (entry.Exception == null)
                return;

            text.AppendLine();
            text.AppendLine("Stack Trace");
            text.AppendLine();
            text.AppendLine(entry.Exception.StackTrace);
            text.AppendLine(TextResources.DashedBreak80Wide);
        }