/// <summary> /// Shows first <c>rowLimit</c> and provides exported versions /// </summary> /// <param name="script">The script.</param> /// <param name="source">The source.</param> /// <param name="title">The title.</param> /// <param name="rowLimit">The row limit.</param> /// <returns></returns> public static void AppendMacroRecordLogFileBlock(this ITextAppendContentExtended script, ILogBuilder loger, string title, int lastLines = 20, macroOptions options = macroOptions.common) { string description = ""; List <string> lines = loger.ContentToString().breakLines(true); int ln = Math.Min(lines.Count(), lastLines); if (ln == 0) { return; } lines.Reverse(); //if (lines.Count < ln) //{ // description = "Log content from `" + loger.outputPath + "` with (" + ln + ") lines."; //} //else //{ // description = "Excerpt from log `" + loger.outputPath + "` limited to last (" + ln + ") lines. Total log count:" + lines.Count + "). For complete content open one of files below."; //} if (options.HasFlag(macroOptions.wrapp)) { script.open(nameof(bootstrap_containers.well), title, description); } else { script.AppendHeading(title, 4); } script.AppendLine("Log contains [" + lines.Count() + "] lines - the last [" + ln + "] is included below."); DataTable dr = lines.buildDataTable(imbStringCollectionExtensions.buildDataTableOptions.addCounterColumn | imbStringCollectionExtensions.buildDataTableOptions.extractExceptions, "Log"); if (dr.validateTable()) { DataTable output = dr.GetLimited(ln); output.SetDescription(description); script.AppendTable(output); script.AppendHorizontalLine(); script.open(nameof(bootstrap_containers.buttontoolbar), "Format options", ""); script.open(nameof(bootstrap_containers.buttongroup), "Data", ""); script.Attachment(dr, dataTableExportEnum.csv, "CSV", bootstrap_color.info, bootstrap_size.sm); script.Attachment(dr, dataTableExportEnum.excel, "Excel", bootstrap_color.primary, bootstrap_size.sm); script.Attachment(dr, dataTableExportEnum.json, "JSON", bootstrap_color.info, bootstrap_size.sm); script.close(); script.open(nameof(bootstrap_containers.buttongroup), "Text", ""); script.Attachment(loger.ContentToString(), title.getFilename(".md"), "Markdown", bootstrap_color.gray, bootstrap_size.sm); script.close(); script.close(); } else { script.AppendLabel("The log is empty", true, bootstrap_color.warning); } if (options.HasFlag(macroOptions.wrapp)) { script.close(); } else { script.AppendLine(description); } }