123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- #region --------------- Copyright Dresser Wayne Pignone -------------
- #endregion
- using System;
- using System.Text;
- using System.Diagnostics.CodeAnalysis;
- namespace Wayne.Lib.Log
- {
-
-
-
- public class ExceptionLogEntry : ErrorLogEntry
- {
- #region Fields
- private Exception exception;
- #endregion
- #region Construction
-
-
-
-
-
-
-
- [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object")]
- public ExceptionLogEntry(IIdentifiableEntity entity, ErrorLogSeverity severity, object logObject, Exception exception)
- : base(entity, severity, logObject)
- {
- this.exception = exception;
- }
-
-
-
-
-
-
-
-
- [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object")]
- public ExceptionLogEntry(IIdentifiableEntity entity, ErrorLogSeverity severity, object logObject, object category, Exception exception)
- : base(entity, severity, logObject, category)
- {
- this.exception = exception;
- }
- #endregion
- #region Properties
-
-
-
- public Exception Exception
- {
- get { return exception; }
- }
- #endregion
- #region Methods: AppendTextToStringBuilder
-
-
-
-
-
-
-
-
- internal override void AppendToStringBuilder(LogWriter logWriter, StringBuilder output,
- int indentLength, ref bool isFirstLine, ref string indent)
- {
- base.AppendToStringBuilder(logWriter, output, indentLength, ref isFirstLine, ref indent);
-
- if (exception != null)
- {
- StringLogObject.EnsureIndent(indentLength, ref indent);
- string headerText = "Exception: ";
- Exception ex = exception;
- while (ex != null)
- {
- StringLogObject.AppendStringToStringBuilder(headerText + ex.ToString(), output, logWriter, indentLength, ref isFirstLine, ref indent);
-
- ex = ex.InnerException;
- if (ex != null)
- {
-
- indent += " ";
- headerText = "Inner Exception: ";
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- }
- #endregion
- }
- }
|