public string ToString(OperationLogItemFormatFlags flags) { StringBuilder builder = new StringBuilder(); if ((int)(flags & OperationLogItemFormatFlags.IncludeLogLevel) != 0) { builder.Append(this.Level.ToString()); builder.Append(": "); } // add... builder.Append(this.Message); // ex? if (this.Exception != null) { if ((int)(flags & OperationLogItemFormatFlags.UseBrTagSeparator) != 0) { builder.Append("<BR /> "); } else { builder.Append("\r\n\t"); } // now what... if ((int)(flags & OperationLogItemFormatFlags.IncludeExceptionMessage) != 0) { builder.Append(this.Exception.Message); } else if ((int)(flags & OperationLogItemFormatFlags.IncludeFullException) != 0) { // mbr - 08-02-2007 - added br formatting... string exAsString = this.Exception.ToString(); if ((int)(flags & OperationLogItemFormatFlags.UseBrTagSeparator) != 0) { exAsString = exAsString.Replace("\n", "<BR />"); } // append... builder.Append(exAsString); } } // return... return(builder.ToString()); }
public string ToString(OperationLogItemFormatFlags flags) { string sep = "\r\n"; if ((int)(flags & OperationLogItemFormatFlags.UseBrTagSeparator) != 0) { sep = "<BR />"; } // build... StringBuilder builder = new StringBuilder(); foreach (OperationLogItem item in this.InnerList) { if (builder.Length > 0) { builder.Append(sep); } builder.Append(item.ToString(flags)); } // return... return(builder.ToString()); }