/// <summary> /// Standard format for this class /// </summary> /// <returns>String value of this class</returns> public new virtual string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("{0:yyyy-MM-dd HH:mm:ss.fff} {4}:: {1}({2}) {3}", this.TimeStamp, this.Severity, this.Priority, _messageText.Left(60, "..."), Utils.Date.TZAbbreviation); sb.AppendLine(" Full Message: {0}", indentRow(this._messageText, 17)); sb.AppendLine(" Severity: {0}", this.Severity); sb.AppendLine(" Priority: {0}", this.Priority); sb.AppendLine(" Application: {0}", this.ApplicationKey); sb.AppendLine(" Activity Id: {0}", this.ActivityId); sb.AppendLine(" Environment: {0}", this.ActiveEnvironment); sb.AppendLine(" Machine: {0}", this.HostName); sb.AppendLine(" Logger Name: {0}", this.LoggerName); sb.AppendLine(" Message Type: {0}", this.MessageType); sb.AppendLine(" Categories: Count({0})", (Categories == null) ? 0 : Categories.Count); for (int x = 0; x < Categories.Count; x++) { sb.AppendLine(" {0}: {1}", x, Categories[x]); } if (ExtendedProperties != null) { foreach (string key in ExtendedProperties.Keys) { sb.AppendLine(" {0}:{1}", key, ExtendedProperties[key].ToString().Replace(Environment.NewLine, Environment.NewLine + " ")); } } sb.Append(_callerInfo.ToString()); return(sb.ToString()); }
/// <summary> /// Standard format for this class /// </summary> /// <returns>String value of this class</returns> public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("{0:yyyy-MM-dd HH:mm:ss.fff} {4}:: {1}({2}) {3}", this.TimeStamp, this.Severity, this.Priority, _messageText.Left(60, "..."), Utils.Date.TZAbbreviation); sb.AppendLine(" Full Message: {0}", indentRow(this._messageText, 17)); sb.AppendLine(" Severity: {0}({1})", this.Severity, (int)this.Severity); sb.AppendLine(" Priority: {0}({1})", this.Priority, (int)this.Priority); if (string.IsNullOrWhiteSpace(this.MessageCode) == false) { sb.AppendLine(" Message Number: {0}", this.MessageCode); } sb.AppendLine(" Application: {0}", this.ApplicationKey); sb.AppendLine(" Activity Id: {0}", this.ActivityId); sb.AppendLine(" Environment: {0}", this.ActiveEnvironment); sb.AppendLine(" Machine: {0}", this.HostName); sb.AppendLine(" Logger Name: {0}", this.LoggerName); sb.AppendLine(" Message Type: {0}", this.MessageType); sb.AppendLine(" Categories: Count({0})", (Categories == null) ? 0 : Categories.Count); for (int x = 0; x < Categories.Count; x++) { sb.AppendLine(" {0}: {1}", x, Categories[x]); } if (ExtendedProperties != null) { foreach (var prop in ExtendedProperties) { sb.AppendLine(" {0}:{1}", prop.Key, ExtendedProperties[prop.Key].ToString().Replace(Environment.NewLine, Environment.NewLine + " ")); } } if (this.Exceptions != null && this.Exceptions.Count > 0) { foreach (var exception in Exceptions) { sb.AppendFormat(" Exception: {0}{1}", exception, Environment.NewLine); } } else { sb.AppendFormat(" Exception: {0}{1}", "(none)", Environment.NewLine); } sb.Append(_callerInfo.ToString()); return(sb.ToString()); }